72 lines
2.1 KiB
Bash
Executable File
72 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
ROOT=$(cd "$(dirname "$0")/.." && pwd)
|
|
RUNTIME="$ROOT/runtime"
|
|
EVIDENCE=${ABG_EVIDENCE_DIR:?ABG_EVIDENCE_DIR is required}
|
|
GODOT=${GODOT_BIN:-/Applications/Godot.app/Contents/MacOS/Godot}
|
|
|
|
mkdir -p "$EVIDENCE/logs/headless" "$EVIDENCE/logs/normal" "$EVIDENCE/captures"
|
|
|
|
strict_scan() {
|
|
local log=$1
|
|
if grep -En 'SCRIPT ERROR:|Parse Error:|ERROR:|ObjectDB instances leaked|resources still in use at exit|RID allocations of type|RID of type' "$log"; then
|
|
echo "strict diagnostics in $log" >&2
|
|
return 86
|
|
fi
|
|
}
|
|
|
|
require_marker() {
|
|
local log=$1
|
|
local marker=$2
|
|
local count
|
|
count=$(grep -Ec "^${marker}( |$)" "$log" || true)
|
|
if [ "$count" -ne 1 ]; then
|
|
echo "marker $marker count=$count in $log" >&2
|
|
return 87
|
|
fi
|
|
}
|
|
|
|
run_godot() {
|
|
local mode=$1
|
|
local script=$2
|
|
local marker=$3
|
|
local log="$EVIDENCE/logs/$mode/${script%.gd}.log"
|
|
if [ "$mode" = headless ]; then
|
|
"$GODOT" --headless --audio-driver Dummy --path "$RUNTIME" \
|
|
--script "res://tests/dev1/$script" >"$log" 2>&1
|
|
else
|
|
"$GODOT" --audio-driver Dummy --path "$RUNTIME" \
|
|
--script "res://tests/dev1/$script" >"$log" 2>&1
|
|
fi
|
|
strict_scan "$log"
|
|
require_marker "$log" "$marker"
|
|
tail -n 1 "$log"
|
|
}
|
|
|
|
import_log="$EVIDENCE/logs/import.log"
|
|
"$GODOT" --headless --editor --audio-driver Dummy --path "$RUNTIME" --import >"$import_log" 2>&1
|
|
strict_scan "$import_log"
|
|
|
|
while IFS='|' read -r script marker; do
|
|
[ -n "$script" ] || continue
|
|
run_godot headless "$script" "$marker"
|
|
done <<'TESTS'
|
|
boot_service_test.gd|ABG_DEV1_BOOT_OK
|
|
boot_runtime_test.gd|ABG_DEV1_BOOT_RUNTIME_OK
|
|
first_launch_test.gd|ABG_DEV1_FIRST_LAUNCH_OK
|
|
title_state_test.gd|ABG_DEV1_TITLE_OK
|
|
settings_credits_test.gd|ABG_DEV1_SETTINGS_OK
|
|
entry_flow_touch_test.gd|ABG_DEV1_ENTRY_TOUCH_OK
|
|
TESTS
|
|
|
|
run_godot normal entry_capture_test.gd ABG_DEV1_ENTRY_CAPTURE_OK
|
|
|
|
capture_count=$(find "$EVIDENCE" -type f -name '*.png' | wc -l | tr -d ' ')
|
|
if [ "$capture_count" -ne 20 ]; then
|
|
echo "capture count=$capture_count; expected 20" >&2
|
|
exit 89
|
|
fi
|
|
|
|
printf 'ABG_DEV1_CANDIDATE_SUITE_OK headless=6 normal=1 captures=%s strict=0 parsed_touch=true\n' "$capture_count"
|