Skip to content

Commit 957061b

Browse files
committed
Fix src/test/ui/env-vars.rs on 128-core machines on Windows
On Windows, the environment variable NUMBER_OF_PROCESSORS has special meaning. Unfortunately, you can get different answers, depending on whether you are enumerating all environment variables or querying a specific variable. This was causing the src/test/ui/env-vars.rs test to fail on machines with more than 64 processors when run on Windows.
1 parent 5be3f9f commit 957061b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Diff for: src/test/ui/env-vars.rs

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ use std::env::*;
55

66
fn main() {
77
for (k, v) in vars_os() {
8+
// On Windows, the environment variable NUMBER_OF_PROCESSORS has special meaning.
9+
// Unfortunately, you can get different answers, depending on whether you are
10+
// enumerating all environment variables or querying a specific variable.
11+
// This was causing this test to fail on machines with more than 64 processors.
12+
if cfg!(target_os = "windows") && k == "NUMBER_OF_PROCESSORS" {
13+
continue;
14+
}
15+
816
let v2 = var_os(&k);
917
assert!(v2.as_ref().map(|s| &**s) == Some(&*v),
1018
"bad vars->var transition: {:?} {:?} {:?}", k, v, v2);

0 commit comments

Comments
 (0)