Skip to content
Closed
Changes from 2 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
12 changes: 11 additions & 1 deletion library/test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,17 @@ pub fn run_test(
let supports_threads = !cfg!(target_os = "emscripten") && !cfg!(target_arch = "wasm32");
if concurrency == Concurrent::Yes && supports_threads {
let cfg = thread::Builder::new().name(name.as_slice().to_owned());
cfg.spawn(runtest).unwrap();
match cfg.spawn(runtest) {
Ok(_) => {}
Err(err @ io::Error { .. }) if err.kind() == io::ErrorKind::WouldBlock => {
// If spawning a new thread would block, and blocking was
// requested to not occur, just run the test synchronously.
runtest();
}
Err(err) => {
panic!("spawning a test thread failed: {}", err);
}
}
} else {
runtest();
}
Expand Down