Running the game window on this machine revealed that earlier automated runs had polluted the real user:// profile: the skyport showed a leftover rebuild count, 5 crystal and an unlocked H04 that no fresh player should have. The headless suite could never catch this because it only checked assertions, not which save file it was writing to. ProfileStore now resolves its save path through WINDROOST_SAVE_DIR, defaulting to the real user:// location for the player. A shared _test_env.sh points every test runner at a temporary directory, so no automated run can overwrite the player's profile again. The polluted real save was backed up to /tmp and removed, so a first launch starts clean. Verified by running a save-writing test: the temp directory gained a profile, the real user:// path stayed absent. tools/run_p2_checks.sh still runs 16 gates; all pass. The live Godot process was terminated after inspection.
49 lines
1003 B
Bash
Executable File
49 lines
1003 B
Bash
Executable File
#!/bin/zsh
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="${0:A:h}"
|
|
source "${0:A:h}/_test_env.sh"
|
|
GODOT_BIN="${GODOT_BIN:-/Applications/Godot.app/Contents/MacOS/Godot}"
|
|
LOG_PATH="$ROOT_DIR/artifacts/p3a_loop_test.log"
|
|
TIMEOUT_SECONDS="${P3A_TEST_TIMEOUT_SECONDS:-180}"
|
|
|
|
if [[ ! -x "$GODOT_BIN" ]]; then
|
|
print -u2 "Godot binary not found: $GODOT_BIN"
|
|
exit 127
|
|
fi
|
|
|
|
mkdir -p "$ROOT_DIR/artifacts"
|
|
|
|
"$GODOT_BIN" --headless --path "$ROOT_DIR" --script res://scripts/p3a_loop_test.gd \
|
|
> "$LOG_PATH" 2>&1 &
|
|
GODOT_PID=$!
|
|
|
|
(
|
|
sleep "$TIMEOUT_SECONDS"
|
|
kill -TERM "$GODOT_PID" 2>/dev/null || true
|
|
sleep 5
|
|
kill -KILL "$GODOT_PID" 2>/dev/null || true
|
|
) &
|
|
WATCHDOG_PID=$!
|
|
|
|
set +e
|
|
wait "$GODOT_PID"
|
|
STATUS=$?
|
|
set -e
|
|
|
|
kill -TERM "$WATCHDOG_PID" 2>/dev/null || true
|
|
wait "$WATCHDOG_PID" 2>/dev/null || true
|
|
|
|
cat "$LOG_PATH"
|
|
|
|
if [[ $STATUS -ne 0 ]]; then
|
|
print -u2 "P3A_LOOP_FAIL exit=$STATUS"
|
|
exit "$STATUS"
|
|
fi
|
|
|
|
grep -q "P3A_LOOP_PASS" "$LOG_PATH" || {
|
|
print -u2 "P3A_LOOP_FAIL missing pass marker"
|
|
exit 4
|
|
}
|
|
exit 0
|