Serialize Gradle and test runs

This commit is contained in:
hgranthorner
2026-08-06 13:07:31 -04:00
parent 427269ad78
commit 0658550d09
5 changed files with 86 additions and 14 deletions

12
jaitest
View File

@@ -4,10 +4,9 @@
# 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.
# A repository-wide lock serializes Gradle/test runs. Without it, an editor or
# another agent can delete build/test-results while this process is writing JUnit
# XML, producing EOFException or a missing in-progress-results bin.
#
# A `--tests` filter STICKS: Gradle reuses the configuration cache entry from the
# previous run, so a later unfiltered `./jaitest` silently re-runs just that one
@@ -18,6 +17,11 @@
set -uo pipefail
cd "$(dirname "$0")" || exit 1
source ./gradle-lock.sh
jai_gradle_lock_acquire
trap jai_gradle_lock_release EXIT
trap 'exit 130' INT
trap 'exit 143' TERM
extra=()
if [[ " $* " != *" --tests "* ]]; then