Add skip_test and --no-skip; fix a suite that reported green while dying - #25
Merged
Merged
Conversation
skip_test ends the test it is called from. Callers previously wrote
`probe_capability && return` at every site, because a bash function can
only return from itself - a skip helper that merely returns leaves the rest
of the body running. Test bodies now run in a SUBSHELL whose exit code
carries the verdict out (77 = skipped), which is what makes an immediate
abandon possible. Expectation errors live in a variable the subshell cannot
write back, so they are folded into that exit code inside it.
--no-skip turns every skip into a failure, for an environment that
GUARANTEES the capability a test probes for. That is not hypothetical: a
FUSE test suite skipped every mount and reported "PASSED in 0.1s" on a
machine that could mount, hiding the whole kernel path.
Adding the subshell surfaced something worse, which this also fixes. THIS
REPOSITORY'S OWN TEST SUITE WAS DYING AT CASE 5 OF 12 AND REPORTING PASS.
Two independent bugs stacked:
- The EXIT trap's own last command became the script's exit status, so a
`rm` returning 0 turned a fatal abort into success. The trap now
captures the status first and re-exits with it.
- bash 3.2 - which macOS ships - treats "${@}" and "${array[@]}" as
unbound under `set -u` when empty, so passing an EMPTY array to
expect_contains aborted the shell. Fixed in the library and in the
tests that exercise it.
The suite now genuinely runs 10 of 10 rather than 4. A test framework
reporting green for tests it did not run is the worst bug it can have, so
this is the more important half of the change.
Verified: all 5 targets pass; skip counters asserted after test_runner
(a skipped test cannot assert about itself); the body-continues-past-skip
case fails loudly if the subshell ever goes away; --no-skip exercised
through the real flag parser, not just the variable.
helly25
enabled auto-merge (squash)
August 16, 2026 20:27
Fab-Cat
approved these changes
Aug 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add skip_test and --no-skip; fix a suite that reported green while dying
skip_test ends the test it is called from. Callers previously wrote
probe_capability && returnat every site, because a bash function canonly return from itself - a skip helper that merely returns leaves the rest
of the body running. Test bodies now run in a SUBSHELL whose exit code
carries the verdict out (77 = skipped), which is what makes an immediate
abandon possible. Expectation errors live in a variable the subshell cannot
write back, so they are folded into that exit code inside it.
--no-skip turns every skip into a failure, for an environment that
GUARANTEES the capability a test probes for. That is not hypothetical: a
FUSE test suite skipped every mount and reported "PASSED in 0.1s" on a
machine that could mount, hiding the whole kernel path.
Adding the subshell surfaced something worse, which this also fixes. THIS
REPOSITORY'S OWN TEST SUITE WAS DYING AT CASE 5 OF 12 AND REPORTING PASS.
Two independent bugs stacked:
rmreturning 0 turned a fatal abort into success. The trap nowcaptures the status first and re-exits with it.
unbound under
set -uwhen empty, so passing an EMPTY array toexpect_contains aborted the shell. Fixed in the library and in the
tests that exercise it.
The suite now genuinely runs 10 of 10 rather than 4. A test framework
reporting green for tests it did not run is the worst bug it can have, so
this is the more important half of the change.
Verified: all 5 targets pass; skip counters asserted after test_runner
(a skipped test cannot assert about itself); the body-continues-past-skip
case fails loudly if the subshell ever goes away; --no-skip exercised
through the real flag parser, not just the variable.
Note on the version: bumped 0.5.1 -> 0.6.0. The subshell means a test body can no longer leak variables into later tests, which is a behaviour change even though it is the safer semantics.