Skip to content

fix(runner): run the file teardown before a bad annotation aborts - #1334

Merged
Chemaclass merged 2 commits into
mainfrom
fix/1329-annotation-abort-runs-file-teardown
Aug 21, 2026
Merged

fix(runner): run the file teardown before a bad annotation aborts#1334
Chemaclass merged 2 commits into
mainfrom
fix/1329-annotation-abort-runs-file-teardown

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

🤔 Background

Related #1329

A malformed # @timeout or # @retry aborted the run from inside call_test_functions. set_up_before_script had already run, so the file's tear_down_after_script never got a frame and whatever the setup acquired was leaked. Sequential and --parallel both leaked it.

💡 Changes

  • The annotation validator reports instead of exiting, so the frame that owns the file's teardown runs it before honouring the abort. Same shape as the bench runner's fix for bashunit bench aborts on a malformed annotation without running tear_down_after_script #1322.
  • The abort still stops the run: a value the runner cannot honour would otherwise run a different test than the one asked for (Malformed benchmark annotations are silently ignored #884). The error text and the non-zero exit code are unchanged.
  • Four acceptance tests: @timeout and @retry, each under --no-parallel and --parallel.
  • Not in scope: under --parallel a malformed annotation next to a passing file still exits 0. That is a pre-existing exit-code defect, not this teardown leak, and it gets its own issue.

A malformed @timeout or @Retry aborted the run with `exit 1` from inside
`call_test_functions`. `set_up_before_script` had already run, so whatever it
acquired was leaked: the file's `tear_down_after_script` never got a frame.

`annotations_validate` now reports instead of exiting, `call_test_functions`
returns non-zero, and the caller that owns the file's teardown runs it before
honouring the abort. Same shape as the bench runner's fix for #1322.

The error text and the non-zero exit code are unchanged.

Closes #1329
@Chemaclass Chemaclass added the bug Something isn't working label Aug 21, 2026
@Chemaclass Chemaclass self-assigned this Aug 21, 2026
`call_test_functions ... || file_status=$?` put the whole test run in a context
where bash ignores errexit, and bash carries that down into every function and
subshell the command calls. The `set -e` that aborts a failing `set_up` stopped
firing, so a broken hook reported as passing: three acceptance tests failed on
every Linux job while passing on bash 3.2.

Read `$?` on the next line instead. This shell runs with errexit off, so a
non-zero return does not abort it and the file's teardown still runs.
@Chemaclass
Chemaclass merged commit 40560c2 into main Aug 21, 2026
37 checks passed
@Chemaclass
Chemaclass deleted the fix/1329-annotation-abort-runs-file-teardown branch August 21, 2026 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant