Skip to content

Commit

Permalink
Auto merge of #8286 - ehuss:fix-close-output, r=alexcrichton
Browse files Browse the repository at this point in the history
Fix several issues with close_output test.

This test had several mistakes in it:

* On Windows, the test took several minutes to run. The sleep ran very slowly, and wasn't even necessary.
* On Windows, there is an output filename collision with `foo.pdb` because it is used for both the DLL and the executable.  (Note: I'm not sure, maybe we should not uplift proc-macros?)
* The output wasn't being verified (I forgot that `lines_match` returns a bool, and does not panic).  Someday in the future I would like to use a general-purpose line match/differ that is easier to use (not just on `ProcessBuilder`).
  • Loading branch information
bors committed May 26, 2020
2 parents 9fcb8c1 + e2d1d24 commit 8fd2656
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions tests/testsuite/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4840,6 +4840,9 @@ fn close_output() {
[lib]
proc-macro = true
[[bin]]
name = "foobar"
"#,
)
.file(
Expand All @@ -4864,15 +4867,14 @@ fn close_output() {
} else {
println!("{}", i);
}
std::thread::sleep(std::time::Duration::new(0, 1));
}
TokenStream::new()
}
"#
.replace("__ADDR__", &addr.to_string()),
)
.file(
"src/main.rs",
"src/bin/foobar.rs",
r#"
foo::repro!();
Expand Down Expand Up @@ -4913,19 +4915,27 @@ fn close_output() {
};

let stderr = spawn(false);
lines_match(
"\
assert!(
lines_match(
"\
[COMPILING] foo [..]
hello stderr!
[ERROR] [..]
[WARNING] build failed, waiting for other jobs to finish...
[ERROR] build failed
",
&stderr,
&stderr,
),
"lines differ:\n{}",
stderr
);

// Try again with stderr.
p.build_dir().rm_rf();
let stdout = spawn(true);
lines_match("hello_stdout!", &stdout);
assert!(
lines_match("hello stdout!\n", &stdout),
"lines differ:\n{}",
stdout
);
}

0 comments on commit 8fd2656

Please sign in to comment.