Skip to content
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

Regression test println!() panic message on ErrorKind::BrokenPipe #108980

Merged
merged 1 commit into from
Jul 28, 2023

Conversation

Enselic
Copy link
Member

@Enselic Enselic commented Mar 10, 2023

No existing test (that I could find) failed if the panic!() of the println!() family of functions was removed, or if its message was changed:

if let Err(e) = global_s().write_fmt(args) {
panic!("failed printing to {label}: {e}");
}

So add such a test.

This is in preparation of adding a hint about the existence of unix_sigpipe if that is the reason for the panic.

Even if we don't end up adding a hint, this is still a sensible test to have, I think.

@rustbot label +A-testsuite +A-io +T-libs +O-unix

@rustbot
Copy link
Collaborator

rustbot commented Mar 10, 2023

r? @jackh726

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-io Area: std::io, std::fs, std::net and std::path A-testsuite Area: The testsuite used to check the correctness of rustc O-unix Operating system: Unix-like T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Mar 10, 2023
@Enselic
Copy link
Member Author

Enselic commented Mar 10, 2023

I'm pretty sure T-libs is more appropriate for this PR than T-compiler.

@rustbot label -T-compiler

r? T-libs

@rustbot rustbot removed the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 10, 2023
@rustbot
Copy link
Collaborator

rustbot commented Mar 10, 2023

Failed to set assignee to T-libs: invalid assignee

Note: Only org members, users with write permissions, or people who have commented on the PR may be assigned.

@Enselic Enselic mentioned this pull request Mar 10, 2023
23 tasks
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 10, 2023
@Noratrieb
Copy link
Member

r? libs

@Enselic
Copy link
Member Author

Enselic commented Mar 10, 2023

CI passed and the code and its output looks good to me. This is ready for review.

@rustbot ready

@rustbot label -A-testsuite

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. A-testsuite Area: The testsuite used to check the correctness of rustc labels Mar 10, 2023
@Enselic
Copy link
Member Author

Enselic commented Apr 30, 2023

@joshtriplett Friendly 7-week review ping. There is no urgency to review this; I just want to double-check that this PR has not gone under your radar :)

Elevator pitch for this PR: I want to make the println!() panic message on BrokenPipe suggest the use of unix_sigpipe. But before I make any changes I want there to be a regression test in place for the current behavior. This PR is that regression test.

Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thorough test

@workingjubilee
Copy link
Member

@bors r+ rollup=always

@bors
Copy link
Contributor

bors commented Jul 26, 2023

📌 Commit 4dc5e61 has been approved by workingjubilee

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 26, 2023
@workingjubilee
Copy link
Member

or: looks good to me.
r? @workingjubilee

workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Jul 26, 2023
…=workingjubilee

Regression test `println!()` panic message on `ErrorKind::BrokenPipe`

No existing test (that I could find) failed if the `panic!()` of the `println!()` family of functions was removed, or if its message was changed:

https://github.com/rust-lang/rust/blob/104f4300cfddbd956e32820ef202a732f06ec848/library/std/src/io/stdio.rs#L1007-L1009

So add such a test.

This is in preparation of adding a hint about the existence of [`unix_sigpipe`](rust-lang#97889) if that is the reason for the panic.

Even if we don't end up adding a hint, this is still a sensible test to have, I think.

`@rustbot` label +A-testsuite +A-io +T-libs +O-unix
No existing test failed if the [`panic!()`][1] of the `println!()`
family of functions was removed, or if its message was changed.

So add such a test.

[1] https://github.com/rust-lang/rust/blob/104f4300cfddbd956e32820ef202a732f06ec848/library/std/src/io/stdio.rs#L1007-L1009
@Enselic
Copy link
Member Author

Enselic commented Jul 26, 2023

@workingjubilee I pushed a fix for the CI failure. I had to add .env("RUST_BACKTRACE", "0") to the test child process. I could reproduce the CI failure locally with RUST_BACKTRACE=1 ./x test --force-rerun tests/ui/process/println-with-broken-pipe.rs and this fix worked locally, so will probably also work in bors CI.

@workingjubilee
Copy link
Member

Thank you for being so quick to look into that! I am going to give this a slightly closer look to verify before r+ing again.

Comment on lines +20 to +21
let mut args = env::args();
let me = args.next().unwrap();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...cute.


// Set up a pipeline with a short-lived consumer and wait for it to finish.
// This will produce the `println!()` panic message on stderr.
let mut producer = Command::new(&me)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extremely cute.

@workingjubilee
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jul 27, 2023

📌 Commit 075a6bb has been approved by workingjubilee

It is now in the queue for this repository.

@workingjubilee
Copy link
Member

I feel confident this will pass CI this time, however,
@bors rollup=iffy

@bors
Copy link
Contributor

bors commented Jul 27, 2023

⌛ Testing commit 075a6bb with merge 6cacb52...

@bors
Copy link
Contributor

bors commented Jul 28, 2023

☀️ Test successful - checks-actions
Approved by: workingjubilee
Pushing 6cacb52 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 28, 2023
@bors bors merged commit 6cacb52 into rust-lang:master Jul 28, 2023
11 checks passed
@rustbot rustbot added this to the 1.73.0 milestone Jul 28, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (6cacb52): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.1% [-3.1%, -3.1%] 1
All ❌✅ (primary) - - 0

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-7.4% [-8.0%, -6.7%] 5
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 654.841s -> 652.994s (-0.28%)

@Enselic Enselic deleted the println-and-broken-pipe branch October 7, 2023 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-io Area: std::io, std::fs, std::net and std::path merged-by-bors This PR was explicitly merged by bors. O-unix Operating system: Unix-like S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants