forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#75172 - tmandry:test-thread-capture, r=dtolnay
Capture output from threads spawned in tests Fixes rust-lang#42474. r? @dtolnay since you expressed interest in this, but feel free to redirect if you aren't the right person anymore.
- Loading branch information
Showing
14 changed files
with
177 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// compile-flags: --test | ||
// run-fail | ||
// run-flags: --test-threads=1 | ||
// check-run-results | ||
// exec-env:RUST_BACKTRACE=0 | ||
|
||
#[test] | ||
fn thready_pass() { | ||
println!("fee"); | ||
std::thread::spawn(|| { | ||
println!("fie"); | ||
println!("foe"); | ||
}) | ||
.join() | ||
.unwrap(); | ||
println!("fum"); | ||
} | ||
|
||
#[test] | ||
fn thready_fail() { | ||
println!("fee"); | ||
std::thread::spawn(|| { | ||
println!("fie"); | ||
println!("foe"); | ||
}) | ||
.join() | ||
.unwrap(); | ||
println!("fum"); | ||
panic!(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
running 2 tests | ||
test thready_fail ... FAILED | ||
test thready_pass ... ok | ||
|
||
failures: | ||
|
||
---- thready_fail stdout ---- | ||
fee | ||
fie | ||
foe | ||
fum | ||
thread 'main' panicked at 'explicit panic', $DIR/test-thread-capture.rs:29:5 | ||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace | ||
|
||
|
||
failures: | ||
thready_fail | ||
|
||
test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// compile-flags: --test | ||
// run-fail | ||
// run-flags: --test-threads=1 --nocapture | ||
// check-run-results | ||
// exec-env:RUST_BACKTRACE=0 | ||
|
||
#[test] | ||
fn thready_pass() { | ||
println!("fee"); | ||
std::thread::spawn(|| { | ||
println!("fie"); | ||
println!("foe"); | ||
}) | ||
.join() | ||
.unwrap(); | ||
println!("fum"); | ||
} | ||
|
||
#[test] | ||
fn thready_fail() { | ||
println!("fee"); | ||
std::thread::spawn(|| { | ||
println!("fie"); | ||
println!("foe"); | ||
}) | ||
.join() | ||
.unwrap(); | ||
println!("fum"); | ||
panic!(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
thread 'main' panicked at 'explicit panic', $DIR/test-thread-nocapture.rs:29:5 | ||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
running 2 tests | ||
test thready_fail ... fee | ||
fie | ||
foe | ||
fum | ||
FAILED | ||
test thready_pass ... fee | ||
fie | ||
foe | ||
fum | ||
ok | ||
|
||
failures: | ||
|
||
failures: | ||
thready_fail | ||
|
||
test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters