From e2d1d2456c5732298df6974f99d0cb7a8cf2f04c Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 26 May 2020 11:35:48 -0700 Subject: [PATCH] Fix several issues with close_output test. --- tests/testsuite/build.rs | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/tests/testsuite/build.rs b/tests/testsuite/build.rs index 204d23cef0e..39bba385f68 100644 --- a/tests/testsuite/build.rs +++ b/tests/testsuite/build.rs @@ -4840,6 +4840,9 @@ fn close_output() { [lib] proc-macro = true + + [[bin]] + name = "foobar" "#, ) .file( @@ -4864,7 +4867,6 @@ fn close_output() { } else { println!("{}", i); } - std::thread::sleep(std::time::Duration::new(0, 1)); } TokenStream::new() } @@ -4872,7 +4874,7 @@ fn close_output() { .replace("__ADDR__", &addr.to_string()), ) .file( - "src/main.rs", + "src/bin/foobar.rs", r#" foo::repro!(); @@ -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 + ); }