test(fg4): fix midpoint candidate suite
This commit is contained in:
Executable
+119
@@ -0,0 +1,119 @@
|
||||
#!/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/logs/python"
|
||||
mkdir -p "$EVIDENCE/captures/rg03" "$EVIDENCE/captures/rg04"
|
||||
|
||||
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/fg4/$script" >"$log" 2>&1
|
||||
else
|
||||
"$GODOT" --audio-driver Dummy --path "$RUNTIME" \
|
||||
--script "res://tests/fg4/$script" >"$log" 2>&1
|
||||
fi
|
||||
strict_scan "$log"
|
||||
require_marker "$log" "$marker"
|
||||
tail -n 1 "$log"
|
||||
}
|
||||
|
||||
run_python() {
|
||||
local script=$1
|
||||
local marker=$2
|
||||
local log="$EVIDENCE/logs/python/${script%.py}.log"
|
||||
python3 "$ROOT/tools/$script" >"$log" 2>&1
|
||||
strict_scan "$log"
|
||||
require_marker "$log" "$marker"
|
||||
tail -n 1 "$log"
|
||||
}
|
||||
|
||||
catalog_before=$(shasum -a 256 "$RUNTIME/fg4/rg04_catalog.json" | awk '{print $1}')
|
||||
run_python build_fg4_rg04_catalog.py ABG_FG4_RG04_CATALOG_BUILD_OK
|
||||
catalog_after=$(shasum -a 256 "$RUNTIME/fg4/rg04_catalog.json" | awk '{print $1}')
|
||||
if [ "$catalog_before" != "$catalog_after" ]; then
|
||||
echo "RG-04 catalog builder changed immutable output" >&2
|
||||
exit 88
|
||||
fi
|
||||
run_python verify_fg3_media.py ABG_FG3_MEDIA_OK
|
||||
run_python verify_fg4_media.py ABG_FG4_MEDIA_OK
|
||||
run_python verify_fg2_audio.py ABG_FG2_AUDIO_ASSET_OK
|
||||
run_python verify_fg4_audio.py ABG_FG4_AUDIO_ASSET_OK
|
||||
|
||||
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'
|
||||
content_registry_test.gd|ABG_FG4_CONTENT_REGISTRY_OK
|
||||
market_generator_test.gd|ABG_FG4_CONTRACT1_MARKETS_OK
|
||||
contract1_state_test.gd|ABG_FG4_CONTRACT1_STATE_OK
|
||||
save_v11_test.gd|ABG_FG4_SAVE_V11_OK
|
||||
contract1_rounds_test.gd|ABG_FG4_CONTRACT1_ROUNDS_OK
|
||||
contract1_boss_test.gd|ABG_FG4_CONTRACT1_BOSS_OK
|
||||
contract2_activation_test.gd|ABG_FG4_CONTRACT2_ACTIVATION_OK
|
||||
contract2_market_generator_test.gd|ABG_FG4_CONTRACT2_MARKETS_OK
|
||||
contract2_rounds_test.gd|ABG_FG4_CONTRACT2_ROUNDS_OK
|
||||
contract2_boss_test.gd|ABG_FG4_CONTRACT2_BOSS_OK
|
||||
contract2_save_v11_test.gd|ABG_FG4_CONTRACT2_SAVE_V11_OK
|
||||
campaign_adapter_test.gd|ABG_FG4_CAMPAIGN_ADAPTER_OK
|
||||
rg04_content_registry_test.gd|ABG_FG4_RG04_CONTENT_OK
|
||||
rg04_market_generator_test.gd|ABG_FG4_RG04_MARKETS_OK
|
||||
rg04_activation_test.gd|ABG_FG4_RG04_ACTIVATION_OK
|
||||
rg04_contract1_rounds_test.gd|ABG_FG4_RG04_CONTRACT1_ROUNDS_OK
|
||||
rg04_contract1_boss_test.gd|ABG_FG4_RG04_CONTRACT1_BOSS_OK
|
||||
rg04_contract1_save_v11_test.gd|ABG_FG4_RG04_CONTRACT1_SAVE_V11_OK
|
||||
rg04_contract2_activation_test.gd|ABG_FG4_RG04_CONTRACT2_ACTIVATION_OK
|
||||
rg04_contract2_rounds_test.gd|ABG_FG4_RG04_CONTRACT2_ROUNDS_OK
|
||||
rg04_contract2_boss_test.gd|ABG_FG4_RG04_CONTRACT2_BOSS_OK
|
||||
rg04_contract2_save_v11_test.gd|ABG_FG4_RG04_CONTRACT2_SAVE_V11_OK
|
||||
rg04_campaign_adapter_test.gd|ABG_FG4_RG04_CAMPAIGN_ADAPTER_OK
|
||||
five_profile_simulation_test.gd|ABG_FG4_FIVE_PROFILE_OK
|
||||
candidate_persistence_matrix_test.gd|ABG_FG4_CANDIDATE_PERSISTENCE_OK
|
||||
midpoint_five_profile_simulation_test.gd|ABG_FG4_MIDPOINT_FIVE_PROFILE_OK
|
||||
campaign_runtime_touch_test.gd|ABG_FG4_CAMPAIGN_RUNTIME_TOUCH_OK
|
||||
rg04_campaign_runtime_touch_test.gd|ABG_FG4_RG04_RUNTIME_TOUCH_OK
|
||||
TESTS
|
||||
|
||||
ABG_FG4_MATRIX_CAPTURE_ROOT="$EVIDENCE/captures/rg03" \
|
||||
run_godot normal campaign_runtime_matrix_test.gd ABG_FG4_CAMPAIGN_RUNTIME_MATRIX_OK
|
||||
ABG_FG4_RG04_MATRIX_CAPTURE_ROOT="$EVIDENCE/captures/rg04" \
|
||||
run_godot normal rg04_campaign_runtime_matrix_test.gd ABG_FG4_RG04_RUNTIME_MATRIX_OK
|
||||
|
||||
capture_count=$(find "$EVIDENCE/captures" -type f -name '*.png' | wc -l | tr -d ' ')
|
||||
if [ "$capture_count" -ne 24 ]; then
|
||||
echo "capture count=$capture_count; expected 24" >&2
|
||||
exit 89
|
||||
fi
|
||||
|
||||
printf 'ABG_FG4_MIDPOINT_SUITE_OK godot=30 headless=28 normal=2 python=5 captures=%s strict=0\n' "$capture_count"
|
||||
Reference in New Issue
Block a user