Phase 1 gate: Tier 0 corpus lexer invariants over the whole Jai distribution

Lexes all 714 .jai files (17.1M chars, 3.0M tokens) and asserts round-trip
tiling, strict offset progress, and zero BAD_CHARACTER. Green on first run.

jaitest: use cleanTest and retry once when a concurrent Gradle run clobbers
build/test-results (java.io.EOFException with no XML).
This commit is contained in:
hgranthorner
2026-08-04 10:25:01 -04:00
parent 4469283024
commit ba5d8aba7b
2 changed files with 149 additions and 5 deletions

29
jaitest
View File

@@ -4,19 +4,38 @@
# A green `test` task does not prove tests ran (see AGENTS.md), so this always
# prints tests/failures/errors per suite and dumps failure messages.
#
# Two concurrent Gradle invocations (e.g. an editor/agent running tests in the
# background at the same time) fight over build/test-results and the loser dies
# with `java.io.EOFException` or a missing in-progress-results bin. That is an
# infrastructure failure, not a test failure, so it is retried once.
#
# Usage: ./jaitest [gradle args...] e.g. ./jaitest --tests '*Lexer*'
set -uo pipefail
cd "$(dirname "$0")" || exit 1
rm -rf build/test-results/test
./jaigradle test "$@" 2>&1 | grep -vE '^\[[0-9.]+s\]\[warning\]\[cds\]'
gradle_status=${PIPESTATUS[0]}
run_gradle() {
rm -rf build/reports/tests/test
./jaigradle cleanTest test "$@" 2>&1 | grep -vE '^\[[0-9.]+s\]\[warning\]\[cds\]'
return "${PIPESTATUS[0]}"
}
run_gradle "$@"
gradle_status=$?
shopt -s nullglob
xml=(build/test-results/test/*.xml)
if [ "$gradle_status" -ne 0 ] && [ ${#xml[@]} -eq 0 ]; then
echo
echo "!!! no test XML and a failed build — retrying once (concurrent Gradle run?)"
sleep 3
run_gradle "$@"
gradle_status=$?
xml=(build/test-results/test/*.xml)
fi
echo
echo "=== JUnit XML ==="
shopt -s nullglob
xml=(build/test-results/test/*.xml)
if [ ${#xml[@]} -eq 0 ]; then
echo "NO TEST XML PRODUCED — tests did not run."
exit 1