TableTower/tools/run_tests.sh
RobinFiredrake 0c9ab1aa71 Slim DESIGN.md to a status page; add parallel test runner
DESIGN.md (read every session) keeps status, names and the agreed plan;
architecture and history move to ARCHITECTURE.md and HISTORY.md, read on
demand. tools/run_tests.sh runs the suites in parallel and fails on SCRIPT
ERROR as well as on a missing PASS line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 18:03:10 -06:00

32 lines
1.1 KiB
Bash
Executable file

#!/usr/bin/env bash
# Runs every headless suite in parallel and prints one line per suite.
# A suite fails if it doesn't print "PASS: 0 failure(s)" or if its output has
# a SCRIPT ERROR (a crashed test function can still print PASS).
# Usage: tools/run_tests.sh [name-filter] e.g. tools/run_tests.sh inspector
# Full output of failing suites is printed; passing output is discarded.
set -u
cd "$(dirname "$0")/.."
GODOT="${GODOT:-$HOME/apps/Godot_v4.7.2-stable_linux.x86_64}"
OUT="$(mktemp -d)"
trap 'rm -rf "$OUT"' EXIT
suites=(tests/test_*${1:-}*.gd)
for t in "${suites[@]}"; do
n="$(basename "$t" .gd)"
( timeout 300 "$GODOT" --headless --path . -s "res://$t" -- --sample >"$OUT/$n.log" 2>&1 ) &
while (( $(jobs -rp | wc -l) >= ${JOBS:-8} )); do wait -n; done
done
wait
fail=0
for t in "${suites[@]}"; do
n="$(basename "$t" .gd)"
log="$OUT/$n.log"
if grep -q "PASS: 0 failure(s)" "$log" && ! grep -q "SCRIPT ERROR" "$log"; then
echo "ok $n"
else
echo "FAIL $n"
grep -E "FAIL|SCRIPT ERROR|ERROR|at: " "$log" | head -40
fail=1
fi
done
(( fail )) && echo "SOME SUITES FAILED" || echo "ALL ${#suites[@]} SUITES PASSED"
exit $fail