-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cargo test
does not report failures when a test exits the process
#87323
Comments
cargo test
does not report failurescargo test
does not report failures when a test exits the process
Unfortunately this is pretty fundamentally difficult to fix. The issue is that There are some potential solutions, such as running each test in a separate process, but that would likely have substantial performance penalties. It might be possible to have something like an atexit bomb that would explode if the process tries to exit without completing the tests, but that sounds like it would have its own can of worms. I've transferred this to rust-lang/rust. This is where libtest harness issues are tracked. I thought there was already an issue about this, but I couldn't find it. |
Hm, another thought I just had was that if the tests used JSON, Cargo could take over the responsibility of handling success/failed. It wouldn't be a complete solution, because a test exiting the process would still prevent any other test from running, but just an idea. Maybe there could be a "completed" JSON message that is required for the complete run to be considered a success? EDIT: Link to #49359 for JSON test support. |
You might be thinking of #67650. |
Also this is a really terrible idea, but theoretically libtest could add a SIGABRT handler which doesn't actually exit the process and fails the test instead. Not sure how that could work with parallel tests though. |
This seems similar to #84137. |
Triage: let's close as duplicate to #67650 which is for this use case |
Problem
I'm running
cargo test
with tests that fail, and it exits with code 0 and does not gather and report errors.Steps
git clone https://github.com/apollographql/rover
git checkout avery/repro-tests
panic!("It fails")
cargo test
, you should notice the FAILED test only if you scroll up to look for it, the message at the end makes you think the tests pass.echo $?
and see output 0Possible Solution(s)
No idea why this is happening and... it's quite alarming!
If I run the same tests through my IDE, it makes a call to
cargo test --package rover --lib -- test command::supergraph::config::tests::it_can_fail_a_test --exact --nocapture <
which does fail properly!Notes
This seems to be a cross-platform bug, as our CI runner does not detect issues with any of the following targets:
This is a workspace using the 2018 edition, and seems to happen on test runs with both v1 and v2 of the resolver. It also happens whether you're testing a single package with
-p
, the whole workspace with--workspace
, or justcargo test
by itself.The text was updated successfully, but these errors were encountered: