Teardown must not decide a test's verdict - #792
Merged
Conversation
Under set -e a failing command in an EXIT trap becomes the script's exit status, so a cleanup hiccup fails a test whose assertions all passed. Run teardown with errexit off, on EXIT only: sharing set +e with the signal traps would leave errexit off for the rest of a signalled run, where a torn-down test could still report success. A failing teardown command still prints its own diagnostic, so nothing is silenced. The return 0 that three cleanup() bodies ended with never protected anything: errexit fires at the failing command before it is reached. Closes #773 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Xavier Roche <xroche@gmail.com>
…-773 Signed-off-by: Xavier Roche <xroche@gmail.com> # Conflicts: # tests/Makefile.am
Numbers 99-101 were taken on master while this branch was open. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Xavier Roche <xroche@gmail.com>
…-773 Signed-off-by: Xavier Roche <xroche@gmail.com> # Conflicts: # tests/Makefile.am
…-773 Signed-off-by: Xavier Roche <xroche@gmail.com> # Conflicts: # tests/Makefile.am
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Xavier Roche <xroche@gmail.com>
…-773 Signed-off-by: Xavier Roche <xroche@gmail.com> # Conflicts: # tests/Makefile.am
…-773 Signed-off-by: Xavier Roche <xroche@gmail.com> # Conflicts: # tests/Makefile.am
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.
Under
set -ea failing command in an EXIT trap becomes the script's exit status, so a hiccup while tearing down fixtures fails a test whose assertions all passed. That is what turned57_local-proxy-connect.testred on the Windows x64 leg of #765: five OK lines, no FAIL, exit 1. Every EXIT trap in the suite now runs teardown with errexit off, and the signal traps keep their owntrapline, since sharingset +ewith HUP/INT/QUIT/PIPE/TERM would leave errexit off for the rest of a signalled run and let a torn-down test still report success.A
|| trueon thermwould have been smaller, but it throws away the only diagnostic, and the evidence does not say which teardown command failed: a blockedrm -rfon the Windows runner exits 1 and prints "Device or resource busy", while the log shows exit 1 and nothing at all. The sharing violation in the issue is the plausible mechanism rather than a confirmed one, so whatever it really is now prints its own error.99_teardown-status.testpins the semantics both ways and scans the suite so a new test cannot reintroduce the shape, the leaky combined trap included. Thereturn 0that threecleanup()bodies ended with never protected anything, since errexit fires at the failing command before it is reached.Closes #773