From b95ef1eb691f533878905a39516e9d617a7d4d0d Mon Sep 17 00:00:00 2001 From: clawbot <35+clawbot@noreply.example.org> Date: Mon, 21 Sep 2026 19:43:21 +0200 Subject: [PATCH] fix: script/test conditional-verbose-rerun with -cover (closes #59) script/test now runs the suite quietly first (with -race and -cover, 30s timeout) and re-runs it with -v only when that run fails, then exits non-zero. This is the pattern REPO_POLICIES.md mandates; before, every green run printed full per-test output. What a reader would trip over: the whole compound command is passed as one string to run_with_cgo_deps, so it behaves the same on the host path and under the nix-shell fallback. -cover is on the first run only; the verbose rerun exists for diagnostics. Disclosure: no test was written for the wrapper script itself; the failure path was exercised by hand by author and reviewer. Disclosure: the nix-shell fallback is kept; moving tests into Docker belongs to https://git.eeqj.de/sneak/pixa/issues/101 and https://git.eeqj.de/sneak/pixa/issues/104. Model: opus-4-8 (implementation, review); fable-5-1 (landing message) --- script/test | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/script/test b/script/test index 7192e5c..e9b4954 100755 --- a/script/test +++ b/script/test @@ -17,7 +17,11 @@ run_with_cgo_deps() { main() { cd "$ROOT" echo "Running tests..." - run_with_cgo_deps "CGO_ENABLED=1 go test -timeout 30s -race -v ./..." + # Run without -v first for clean output on success; on failure rerun + # with -v for full diagnostics, then exit non-zero (REPO_POLICIES.md + # conditional-verbose-rerun pattern). The first run already proved the + # tests broken, so the build fails even if the rerun happens to pass. + run_with_cgo_deps "CGO_ENABLED=1 go test -timeout 30s -race -cover ./... || { echo '--- Rerunning with -v for details ---'; CGO_ENABLED=1 go test -timeout 30s -race -v ./...; exit 1; }" } main "$@"