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

Fix close_output test. #8587

Merged
merged 1 commit into from
Aug 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions tests/testsuite/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4975,11 +4975,22 @@ fn close_output() {
let mut buf = [0];
drop(socket.read_exact(&mut buf));
let use_stderr = std::env::var("__CARGO_REPRO_STDERR").is_ok();
for i in 0..10000 {
// Emit at least 1MB of data.
// Linux pipes can buffer up to 64KB.
// This test seems to be sensitive to having other threads
// calling fork. My hypothesis is that the stdout/stderr
// file descriptors are duplicated into the child process,
// and during the short window between fork and exec, the
// file descriptor is kept alive long enough for the
// build to finish. It's a half-baked theory, but this
// seems to prevent the spurious errors in CI.
// An alternative solution is to run this test in
// a single-threaded environment.
for i in 0..100000 {
if use_stderr {
eprintln!("{}", i);
eprintln!("0123456789{}", i);
} else {
println!("{}", i);
println!("0123456789{}", i);
}
}
TokenStream::new()
Expand Down