#!/usr/bin/env bash # Run the test suite and report the JUnit XML, not just the exit code. # # 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. # # 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]} 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 fi total=0 bad=0 for f in "${xml[@]}"; do line=$(sed -n '2p' "$f") name=$(sed -nE 's/^