Skip to content

Commit

Permalink
Auto merge of #8491 - matthiaskrgr:no_num_cpus, r=flip1995
Browse files Browse the repository at this point in the history
tests: use std::thread::available_parallelism() instead of num_cpus to get thread count

removes the dependency added in #8451
---

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: tests: use std::thread::available_parallelism() instead of num_cpus to get thread count
  • Loading branch information
bors committed Mar 2, 2022
2 parents b8a205a + 7a15061 commit 1a25d19
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ futures = "0.3"
parking_lot = "0.11.2"
tokio = { version = "1", features = ["io-util"] }
rustc-semver = "1.1"
num_cpus = "1.13"

[build-dependencies]
rustc_tools_util = { version = "0.2", path = "rustc_tools_util" }
Expand Down
6 changes: 5 additions & 1 deletion tests/compile-test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,11 @@ fn run_ui() {
let _threads = VarGuard::set(
"RUST_TEST_THREADS",
// if RUST_TEST_THREADS is set, adhere to it, otherwise override it
env::var("RUST_TEST_THREADS").unwrap_or_else(|_| num_cpus::get().to_string()),
env::var("RUST_TEST_THREADS").unwrap_or_else(|_| {
std::thread::available_parallelism()
.map_or(1, std::num::NonZeroUsize::get)
.to_string()
}),
);
compiletest::run_tests(&config);
}
Expand Down

0 comments on commit 1a25d19

Please sign in to comment.