You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
--stop-on-failure ends a sequential run with exit from inside the test loop. The file's tear_down_after_script never runs, so anything set_up_before_script acquired is leaked.
Same class as #1318. That one fixed the setup-failure path. This is the stop-on-failure path, and it leaks the same way.
The --parallel path is not affected: it raises a flag file instead of exiting.
Current behavior
The first failing test triggers exit "$EXIT_CODE_STOP_ON_FAILURE". The EXIT trap renders the summary and exits. No file-scoped hook runs, and the output says nothing about it.
$ CLEANUP_MARKER=/tmp/bu-sof.marker ./bashunit --no-parallel --stop-on-failure sof_test.sh
Stop on failure enabled...
Tests: 1 failed, 1 total
$ ls /tmp/bu-sof.marker
/tmp/bu-sof.marker
The same file under --parallel --stop-on-failure releases the resource.
Expected behavior
tear_down_after_script runs before the process exits, so a file-scoped resource can be released in the one place meant for it. Exit code and summary output stay as they are.
Sequential runs execute call_test_functions in the main shell, so that exit leaves src/runner/discovery.sh:235 unreached
The EXIT trap at src/main/run.sh:83 dispatches bashunit::main::handle_stop_on_failure_sync (src/main/run.sh:395), which prints and exits
Acceptance criteria
An acceptance test: a file with a failing test and a tear_down_after_script that releases a resource. Under --no-parallel --stop-on-failure the resource is gone.
Exit code stays EXIT_CODE_STOP_ON_FAILURE.
The "Stop on failure enabled..." output and the failure summary are unchanged. The existing stop-on-failure snapshots still pass.
--parallel --stop-on-failure behaviour unchanged.
A tear_down_after_script that itself fails on this path does not swallow the stop-on-failure exit code.
CHANGELOG.md gets a Fixed entry.
Notes for the implementer
Two shapes. Set a flag that the loop checks after call_test_functions returns, so the normal cleanup block at discovery.sh:235 runs and then the loop breaks. Or run the hook from handle_stop_on_failure_sync, which then needs the current test file in a global the trap can read.
Summary
--stop-on-failureends a sequential run withexitfrom inside the test loop. The file'stear_down_after_scriptnever runs, so anythingset_up_before_scriptacquired is leaked.Same class as #1318. That one fixed the setup-failure path. This is the stop-on-failure path, and it leaks the same way.
The
--parallelpath is not affected: it raises a flag file instead of exiting.Current behavior
The first failing test triggers
exit "$EXIT_CODE_STOP_ON_FAILURE". TheEXITtrap renders the summary and exits. No file-scoped hook runs, and the output says nothing about it.How to reproduce
sof_test.sh:The same file under
--parallel --stop-on-failurereleases the resource.Expected behavior
tear_down_after_scriptruns before the process exits, so a file-scoped resource can be released in the one place meant for it. Exit code and summary output stay as they are.Where it happens
src/runner/diagnostics.sh:75:exit "$EXIT_CODE_STOP_ON_FAILURE"src/runner/exec.sh:689,:710,:751call_test_functionsin the main shell, so thatexitleavessrc/runner/discovery.sh:235unreachedEXITtrap atsrc/main/run.sh:83dispatchesbashunit::main::handle_stop_on_failure_sync(src/main/run.sh:395), which prints and exitsAcceptance criteria
tear_down_after_scriptthat releases a resource. Under--no-parallel --stop-on-failurethe resource is gone.EXIT_CODE_STOP_ON_FAILURE.--parallel --stop-on-failurebehaviour unchanged.tear_down_after_scriptthat itself fails on this path does not swallow the stop-on-failure exit code.CHANGELOG.mdgets aFixedentry.Notes for the implementer
call_test_functionsreturns, so the normal cleanup block atdiscovery.sh:235runs and then the loop breaks. Or run the hook fromhandle_stop_on_failure_sync, which then needs the current test file in a global the trap can read.tear_down_after_scriptis not run whenset_up_before_scriptfails #1318 made. Prefer it unless something blocks it. Ctrl-C does not runtear_down_after_scriptfor the file in flight #1323 needs a "current file" global for the same reason. Build it once and use it in both.--stop-on-failuremust still stop, and must not run the remaining files..claude/rules/bash-style.md.make sa,make lint,./bashunit tests/,./bashunit --parallel tests/.