Skip to content

run-tests.sh (Claude /test skill): fail on non-zero exit, zero tests, or plan mismatch - #106

Merged
jnasbyupgrade merged 2 commits into
Postgres-Extensions:masterfrom
jnasbyupgrade:fix-run-tests-false-pass
Oct 16, 2026
Merged

jnasbyupgrade merged 2 commits into
Postgres-Extensions:masterfrom
jnasbyupgrade:fix-run-tests-false-pass

Conversation

@jnasbyupgrade

@jnasbyupgrade jnasbyupgrade commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Fix issues with run-tests.sh (in the /test claude skill) reporting STATUS: PASS with exit 0 when the make/bats command failed before producing TAP (for example with the test/bats submodule uninitialized).

Runner

  • The command's exit status is taken from PIPESTATUS in the parent shell (a zero there under pipefail still counts as failure).
  • STATUS: FAIL when the command exited non-zero, no tests ran, the TAP plans (1..N) sum to a different count than was reported, or any test failed. The command's own non-zero code is kept; otherwise FAIL exits 1.
  • A REASON: line follows STATUS: on FAIL. With no not ok lines, FAILURES shows the last 20 log lines.

Makefile

  • New test/bats/bin/bats target runs git submodule update --init --recursive test/bats; foundation, test-recursion, test-setup, test, test-extra and test-all depend on it. The runner's direct .bats path runs make test/bats/bin/bats first.

Tests

test/standard/run-tests-script.bats runs the runner from a scratch directory with a stub make/bats (no foundation or Postgres), plus a dry-run check of the Makefile wiring. Against the previous runner 8 of its 10 tests fail.

Evidence

Same input (run-tests.sh no-such-target, make exits 2 with no TAP):

  • Before: STATUS: PASS, TOTAL: 0, EXIT_CODE: 0
  • After: STATUS: FAIL, REASON: command exited 2; no tests ran, EXIT_CODE: 2

Full test-all on the final commit (11cae60): STATUS: PASS, TOTAL: 338 PASSED: 338 FAILED: 0 SKIPPED: 0, EXIT_CODE: 0.

Fixes #95
Fixes Postgres-Extensions/pgxntool#139

🤖 Generated with Claude Code

…Postgres-Extensions#95)

The command's exit status is now captured in the parent shell, and STATUS is
FAIL when the command exited non-zero, no tests ran, or the TAP plans declare
more tests than were reported. A REASON line explains the failure.

The Makefile gains a test/bats/bin/bats target that initializes the submodule;
every target that runs bats (and run-tests.sh's direct .bats path) depends on it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 1dcbba8e-7faa-4bda-8eea-53af385c0d81

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

The command is built as an argv array and run directly, so a bats filter such
as 'foo|wc -l' stays one argument. For direct .bats runs, 'make
test/bats/bin/bats' runs as its own step first. Also reads a final unterminated
log line, derives the Makefile-wiring test's target list from make's rule
database, and tightens two test assertions.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
jnasbyupgrade added a commit to jnasbyupgrade/pgxntool-test that referenced this pull request Oct 16, 2026
A bare Postgres-Extensions#106 in pgxntool-test resolves to this repo's PR, so the
reference now names Postgres-Extensions/pgxntool#106.
@jnasbyupgrade jnasbyupgrade changed the title run-tests.sh: fail on non-zero exit, zero tests, or plan mismatch run-tests.sh (Claude /test skill): fail on non-zero exit, zero tests, or plan mismatch Oct 16, 2026
@jnasbyupgrade
jnasbyupgrade merged commit 1fc89a3 into Postgres-Extensions:master Oct 16, 2026
9 checks passed
@jnasbyupgrade
jnasbyupgrade deleted the fix-run-tests-false-pass branch October 16, 2026 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant