TableTower/tools/run_tests.sh
RobinFiredrake 8fd2b2b8c9 Sheets: a line-per-value helper and Save as a file (Text, Markdown, web page)
The Sheet card's inspector adds a 'Label: {@value}' line for any value
picked. The tray's Copy ▾ gets Save as a file: the roll's sheet (or one
line per result) as Text, Markdown, or an HTML page a browser can print
to PDF, with bold, italics and colours kept where the format allows
(SheetExport). The test runner prints a compile error shared by many
suites once, with the suite names.

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

45 lines
1.5 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
# Failing suites print their first 8 error lines; 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)
# Register any new class_name scripts first (cheap when nothing changed).
"$GODOT" --headless --path . --import >/dev/null 2>&1
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
declare -A first_err
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"
continue
fi
fail=1
e="$(grep -m1 -E "SCRIPT ERROR|^ *FAIL [^:]" "$log")"
# A shared compile error fails many suites the same way: report it once.
if [[ "$e" == *"SCRIPT ERROR"* ]]; then
first_err["$e"]+="$n "
else
echo "FAIL $n"
grep -E "FAIL|SCRIPT ERROR|ERROR" "$log" | head -8
fi
done
for e in "${!first_err[@]}"; do
echo "FAIL ${first_err[$e]}"
echo " $e"
done
(( fail )) && echo "SOME SUITES FAILED" || echo "ALL ${#suites[@]} SUITES PASSED"
exit $fail