Repository navigation
Description
Repo: pgxntool-test
Observed
In a freshly created git worktree of pgxntool-test, the test/bats git submodule is not initialized. make test-setup fails, but .claude/skills/test/scripts/run-tests.sh test-all printed STATUS: PASS and exited 0 without executing any tests. This was found while running the suite for an unrelated change, and was caught only because the real test counts were checked.
Why it matters
This is a false pass. Any automated or agent-driven run in a fresh worktree can silently report success with zero coverage.
Where the status is computed (run-tests.sh)
- L47-58:
CMDismake <target>for a non-.batstarget. - L79-81: the make command runs inside a pipeline element subshell (
{ $CMD 2>&1 || EXIT_CODE=$?; } | tee "$FULL_LOG" | while ...). TheEXIT_CODE=$?assignment at L80 happens in that subshell, so the parent'sEXIT_CODEstays 0. - L146-149: the only correction is
if [ "$FAILED" -gt 0 ] && [ "$EXIT_CODE" -eq 0 ]. When make fails before producing any TAP output,FAILEDis 0, so the failure is never restored. - L172-178:
STATUSisFAILonly whenFAILED > 0,PASS_WITH_SKIPSwhenSKIPPED > 0, otherwisePASS. With zero parsed tests this yieldsPASS. - L197-218 and L220: the summary is written with
STATUS: PASSandEXIT_CODE: 0, and the script ends withexit "$EXIT_CODE".
Nothing checks that TOTAL > 0 or that the make target succeeded.
Expected
- The runner exits non-zero, and reports a
STATUSother thanPASS, whenever the make/test command exits non-zero, regardless of parsed TAP counts. - It also fails when the parsed output contains zero tests.
- The make exit code should be captured in the parent shell (for example via
PIPESTATUSor a temp file), not inside the pipeline subshell.
Possible additional fix
Have make test-setup, or the worktree setup docs/command, initialize submodules (git submodule update --init --recursive), so a fresh worktree has test/bats available.
Related
- Test runner reports PASS with exit 0 when make fails before any TAP output pgxntool#139 reports the same runner bug from the cause side: the make exit status is lost in the pipeline subshell, so a make failure without a
not okline is reported as a pass. PR run-tests.sh (Claude /test skill): fail on non-zero exit, zero tests, or plan mismatch #106 fixes both. - make pgtle exits 0 when pgtle.sh fails for any extension except the last pgxntool#140 is a separate bug of the same kind:
make pgtlejoins the per-extensionpgtle.shcalls with;, so only the last call's exit status counts. PR run-tests.sh (Claude /test skill): fail on non-zero exit, zero tests, or plan mismatch #106 does not address it.
Line references come from reading run-tests.sh. The failing run is taken from the observed report and was not re-executed for this issue.
🤖 Generated with Claude Code
Activity
run-tests.sh (Claude /test skill): fail on non-zero exit, zero tests,…