Files
aetherbound-guild/tools/run_dev4_candidate_suite.sh
T

100 lines
3.6 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}
SOURCE_REVISION=${ABG_SOURCE_REVISION:?ABG_SOURCE_REVISION is required}
GODOT=${GODOT_BIN:-/Applications/Godot.app/Contents/MacOS/Godot}
if [[ ! "$SOURCE_REVISION" =~ ^[0-9a-f]{40}$ ]]; then
echo "DEV-4 candidate requires a source-bound 40-character revision" >&2
exit 85
fi
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 folder=$2
local script=$3
local marker=$4
local suffix=""
if [ -n "${ABG_CAPTURE_FIXTURE_INDEX:-}" ]; then
suffix="_fixture_${ABG_CAPTURE_FIXTURE_INDEX}"
fi
local log="$EVIDENCE/logs/$mode/${folder}_${script%.gd}${suffix}.log"
if [ "$mode" = headless ]; then
"$GODOT" --headless --audio-driver Dummy --path "$RUNTIME" --script "res://tests/$folder/$script" >"$log" 2>&1
else
ABG_EVIDENCE_DIR="$EVIDENCE" \
ABG_CAPTURE_FIXTURE_INDEX="$ABG_CAPTURE_FIXTURE_INDEX" \
"$GODOT" --audio-driver Dummy --fixed-fps 60 --disable-vsync --path "$RUNTIME" --script "res://tests/$folder/$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 folder script marker; do
[ -n "$folder" ] || continue
run_godot headless "$folder" "$script" "$marker"
done <<'TESTS'
dev1|boot_service_test.gd|ABG_DEV1_BOOT_OK
dev1|boot_runtime_test.gd|ABG_DEV1_BOOT_RUNTIME_OK
dev1|first_launch_test.gd|ABG_DEV1_FIRST_LAUNCH_OK
dev1|title_state_test.gd|ABG_DEV1_TITLE_OK
dev1|settings_credits_test.gd|ABG_DEV1_SETTINGS_OK
dev1|entry_flow_touch_test.gd|ABG_DEV1_ENTRY_TOUCH_OK
dev2|initial_company_draft_test.gd|ABG_DEV2_DRAFT_OK
dev2|initial_company_choice_test.gd|ABG_DEV2_CHOICE_OK
dev2|initial_company_touch_test.gd|ABG_DEV2_CHOICE_TOUCH_OK
dev2|initial_company_commit_test.gd|ABG_DEV2_COMMIT_OK
dev2|initial_company_commit_touch_test.gd|ABG_DEV2_COMMIT_TOUCH_OK
dev2|initial_company_full_flow_touch_test.gd|ABG_DEV2_FULL_FLOW_TOUCH_OK
dev3|contract_foundation_test.gd|ABG_DEV3_CONTRACT_OK
dev3|guild_contract_choice_test.gd|ABG_DEV3_GUILD_OK
dev3|market_recruit_review_test.gd|ABG_DEV3_MARKET_OK
dev3|hire_transaction_test.gd|ABG_DEV3_HIRE_OK
dev4|formation_risk_foundation_test.gd|ABG_DEV4_FOUNDATION_OK
dev4|party_line_test.gd|ABG_DEV4_PARTY_OK
dev4|readiness_review_test.gd|ABG_DEV4_READY_OK
dev4|risk_selection_test.gd|ABG_DEV4_RISK_OK
TESTS
for fixture_index in 0 1 2 3; do
ABG_CAPTURE_FIXTURE_INDEX=$fixture_index run_godot normal dev4 formation_risk_capture_test.gd ABG_DEV4_CAPTURE_OK
done
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_DEV4_CANDIDATE_SUITE_OK source=%s dev1=6 dev2=6 dev3=4 dev4=4 normal_processes=4 captures=%s strict=0 parsed_touch=true battle_receipts=0\n' \
"$SOURCE_REVISION" "$capture_count"