Add timed craft queue and hangar

This commit is contained in:
Loïc Wisniewski 2026-08-12 22:47:46 +02:00
commit 82552464d2
14 changed files with 660 additions and 191 deletions

View file

@ -13,6 +13,11 @@ set -uo pipefail
PROJECT_DIR="$1"; shift
JOBS="$1"; shift
VERBOSE="$1"; shift
# A broken test can otherwise leave SceneTree alive after an initialization
# error, printing the same error every frame forever. Gameplay tests normally
# complete in seconds, even on a busy phone, so make that failure explicit
# rather than making the suite look hung. Override for deliberate long runs.
TEST_TIMEOUT_SECONDS="${TEST_TIMEOUT_SECONDS:-120}"
GODOT_BIN="/root/Godot_v4.7.1-stable_linux.arm64"
cd "$PROJECT_DIR" || exit 2
@ -26,6 +31,8 @@ fi
outdir="$(mktemp -d)"
trap 'rm -rf "$outdir"' EXIT
REPORT_DIR="${TEST_REPORT_DIR:-$PROJECT_DIR/.test-results}"
mkdir -p "$REPORT_DIR"
# Import once, serially, before anything runs in parallel. Godot writes to
# .godot/ while importing; several instances discovering a cold cache at the
@ -46,7 +53,8 @@ run_one() {
# 3 parallel runs. Pinned, a test simulates the same 60fps whatever else
# the phone is doing, and its result no longer depends on how busy the
# machine was.
"$GODOT_BIN" --headless --fixed-fps 60 -s "res://tests/$name" >"$log" 2>&1
timeout "$TEST_TIMEOUT_SECONDS" "$GODOT_BIN" --headless --fixed-fps 60 \
-s "res://tests/$name" >"$log" 2>&1
local rc=$?
end=$(date +%s%N)
local ms=$(( (end - start) / 1000000 ))
@ -57,6 +65,16 @@ run_one() {
# while the log says otherwise.
if (( rc == 0 )) && grep -q ": PASS" "$log"; then
printf 'PASS %6dms %s\n' "$ms" "$name" > "$outdir/$name.status"
elif (( rc == 124 )); then
printf 'TIMEOUT %4dms %s (limit %ss)\n' \
"$ms" "$name" "$TEST_TIMEOUT_SECONDS" > "$outdir/$name.status"
elif (( rc == 137 || rc == 139 )); then
# Killed, not failed - almost always the kernel reclaiming memory. Worth
# saying plainly: a killed worker and a failing one both simply produced
# no verdict before, so a whole suite dying to the OOM killer was
# indistinguishable from a hang.
printf 'KILLED %4dms %s (signal %d - out of memory? try JOBS=1)\n' \
"$ms" "$name" "$(( rc - 128 ))" > "$outdir/$name.status"
else
printf 'FAIL %6dms %s (exit %d)\n' "$ms" "$name" "$rc" > "$outdir/$name.status"
fi
@ -90,4 +108,9 @@ done
echo
echo "$(( total - failed ))/$total passed"
# Keep the concise verdicts after the temporary logs are removed. This is
# especially useful from Termux, where a long-running child can outlive the
# terminal command that launched it and its final buffered output is lost.
rm -f "$REPORT_DIR"/*.status
cp "$outdir"/*.status "$REPORT_DIR"/
(( failed == 0 ))