Skip to content

Commit 8fd2656

Browse files
committed
Auto merge of #8286 - ehuss:fix-close-output, r=alexcrichton
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`).
2 parents 9fcb8c1 + e2d1d24 commit 8fd2656

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

tests/testsuite/build.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4840,6 +4840,9 @@ fn close_output() {
48404840
48414841
[lib]
48424842
proc-macro = true
4843+
4844+
[[bin]]
4845+
name = "foobar"
48434846
"#,
48444847
)
48454848
.file(
@@ -4864,15 +4867,14 @@ fn close_output() {
48644867
} else {
48654868
println!("{}", i);
48664869
}
4867-
std::thread::sleep(std::time::Duration::new(0, 1));
48684870
}
48694871
TokenStream::new()
48704872
}
48714873
"#
48724874
.replace("__ADDR__", &addr.to_string()),
48734875
)
48744876
.file(
4875-
"src/main.rs",
4877+
"src/bin/foobar.rs",
48764878
r#"
48774879
foo::repro!();
48784880
@@ -4913,19 +4915,27 @@ fn close_output() {
49134915
};
49144916

49154917
let stderr = spawn(false);
4916-
lines_match(
4917-
"\
4918+
assert!(
4919+
lines_match(
4920+
"\
49184921
[COMPILING] foo [..]
49194922
hello stderr!
49204923
[ERROR] [..]
49214924
[WARNING] build failed, waiting for other jobs to finish...
49224925
[ERROR] build failed
49234926
",
4924-
&stderr,
4927+
&stderr,
4928+
),
4929+
"lines differ:\n{}",
4930+
stderr
49254931
);
49264932

49274933
// Try again with stderr.
49284934
p.build_dir().rm_rf();
49294935
let stdout = spawn(true);
4930-
lines_match("hello_stdout!", &stdout);
4936+
assert!(
4937+
lines_match("hello stdout!\n", &stdout),
4938+
"lines differ:\n{}",
4939+
stdout
4940+
);
49314941
}

0 commit comments

Comments
 (0)