-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
prompt the use of --nocapture
flag if cargo test
process is terminated via a signal.
#12463
prompt the use of --nocapture
flag if cargo test
process is terminated via a signal.
#12463
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @ehuss (or someone else) soon. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
03db36e
to
640c4cf
Compare
I've split the changes into 2 commits as you asked, and changed the display string. The tests are failing right now because it is outputting the --nocapture note even if there's an exec failure. Looking into a fix for this. |
r? epage Hope you don't mind taking this. |
640c4cf
to
6c0ab39
Compare
aa7e623
to
24fb803
Compare
Hi @epage need some help with this.
|
0fb2a72
to
4fffb8b
Compare
|
0633fa2
to
294a589
Compare
@stupendoussuperpowers could you rebase, instead of merge, so I can more easily browse the individual commits? |
1509634
to
67a0402
Compare
btw I'm hosting office hours right now but also available at other times in case you want to do a call. See https://github.com/rust-lang/cargo/wiki/Office-Hours |
Hmm, forgot to look back at this. @stupendoussuperpowers anything left or is this good to go? EDIT: Wow, missed your marking it as ready |
@bors r+ Thanks for all the work you did on this! |
prompt the use of `--nocapture` flag if `cargo test` process is terminated via a signal. Fixes #10855 As per the discussion on this issue, we want to prompt the user to use `--nocapture` if a test is terminated abnormally. The motivation for this change is described in the issue. We check for 3 things before we display this flag. - - `!is_simple` (if the test ended with a non 101 status code) - `harness` (if the standard test harness was used), and - `!nocapture` (whether or not the `--nocapture` flag was already passed to the test) There's further tests added to `test::nonzero_exit_status` that check that the `stderr` is correct for the various combinations possible when a test ends with a non-101 status code. The new expected behavior is - - Display `--nocapture` note for only non-zero exit statuses, when the `--nocapture` flag is not passed. - Only display the note if we use a standard test harness since custom test harnesses do not implement the `--nocapture` flag. To implement the check for the `--nocapture` flag, the function definition for `report_test_errors` was changed to add the `test_args: &[&str]` parameter. This parameter is passed from the immediate calling function. This private function is only called twice change and is not causing regression after making the appropriate changes to both the places it's called in.
💔 Test failed - checks-actions |
Not sure what's going on. Could be the TCP connection accidentally closed. Let's @bors retry and see. |
☀️ Test successful - checks-actions |
Update cargo 21 commits in d78bbf4bde3c6b95caca7512f537c6f9721426ff..7e9de3f4ec3708f500bec142317895b96131e47c 2023-08-03 12:58:25 +0000 to 2023-08-13 00:47:32 +0000 - feat: remove `--keep-going` from `cargo test/bench` (rust-lang/cargo#12478) - chore: window-sys should be a platform-specific dependency (rust-lang/cargo#12483) - docs: make the env var source of rerun-if-env-changed clearer (rust-lang/cargo#12482) - doc: note the backward compatible `.cargo/credential` file exists (rust-lang/cargo#12479) - Fix elided lifetime in associated const (rust-lang/cargo#12475) - prompt the use of `--nocapture` flag if `cargo test` process is terminated via a signal. (rust-lang/cargo#12463) - cargo-credential: reset stdin & stdout to the Console (rust-lang/cargo#12469) - Fix cargo remove incorrectly removing used patches (rust-lang/cargo#12454) - chore(gh): Expand update window (rust-lang/cargo#12466) - Fix panic when enabling http.debug for certain strings (rust-lang/cargo#12468) - fix(cli): Make `--help` easier to browse (rust-lang/cargo#11905) - fix: preserve jobserver file descriptors on rustc invocation to get `TargetInfo` (rust-lang/cargo#12447) - refactor: migrate to `tracing` (rust-lang/cargo#12458) - docs: add example for cargo-credential (rust-lang/cargo#12461) - Bail out an error when using cargo:: in custom build script (rust-lang/cargo#12332) - Fix printing multiple warning messages for unused fields in [registries] table (rust-lang/cargo#12439) - Update windows dependencies (rust-lang/cargo#12453) - Rustfmt a let-else statement (rust-lang/cargo#12451) - Add allow(internal_features) (rust-lang/cargo#12450) - Update pretty_env_logger to 0.5 (rust-lang/cargo#12445) - Remove build metadata from libgit2-sys dependency (rust-lang/cargo#12444) r? `@ghost`
Fixes #10855
As per the discussion on this issue, we want to prompt the user to use
--nocapture
if a test is terminated abnormally. The motivation for this change is described in the issue.We check for 3 things before we display this flag. -
!is_simple
(if the test ended with a non 101 status code)harness
(if the standard test harness was used), and!nocapture
(whether or not the--nocapture
flag was already passed to the test)There's further tests added to
test::nonzero_exit_status
that check that thestderr
is correct for the various combinations possible when a test ends with a non-101 status code.The new expected behavior is -
--nocapture
note for only non-zero exit statuses, when the--nocapture
flag is not passed.--nocapture
flag.To implement the check for the
--nocapture
flag, the function definition forreport_test_errors
was changed to add thetest_args: &[&str]
parameter. This parameter is passed from the immediate calling function. This private function is only called twice change and is not causing regression after making the appropriate changes to both the places it's called in.