diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2018-11-21 21:56:23 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2018-11-21 21:56:23 -0800 |
| commit | d1cd4e8d0d383842acfe2d6ea75eed1e0c0909ac (patch) | |
| tree | f3e77bc5d90d0b32714706b7a9a3b3c7ac60d3ab /src/libstd/process.rs | |
| parent | 0b9f19dff1347e29bf4362ab5a8fab84b43023b5 (diff) | |
| download | rust-d1cd4e8d0d383842acfe2d6ea75eed1e0c0909ac.tar.gz rust-d1cd4e8d0d383842acfe2d6ea75eed1e0c0909ac.zip | |
Move a flaky process test out of libstd
This test ensures that everything in `env::vars()` is inherited but that's not actually true because other tests may add env vars after we spawn the process, causing the test to be flaky! This commit moves the test to a run-pass test where it can execute in isolation. Along the way this removes a lot of the platform specificity of the test, using iteslf to print the environment instead of a foreign process.
Diffstat (limited to 'src/libstd/process.rs')
| -rw-r--r-- | src/libstd/process.rs | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/src/libstd/process.rs b/src/libstd/process.rs index 51481e129df..2d0848252be 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -1890,42 +1890,6 @@ mod tests { } #[test] - fn test_inherit_env() { - use env; - - let result = env_cmd().output().unwrap(); - let output = String::from_utf8(result.stdout).unwrap(); - - for (ref k, ref v) in env::vars() { - // Don't check android RANDOM variable which seems to change - // whenever the shell runs, and our `env_cmd` is indeed running a - // shell which means it'll get a different RANDOM than we probably - // have. - // - // Also skip env vars with `-` in the name on android because, well, - // I'm not sure. It appears though that the `set` command above does - // not print env vars with `-` in the name, so we just skip them - // here as we won't find them in the output. Note that most env vars - // use `_` instead of `-`, but our build system sets a few env vars - // with `-` in the name. - if cfg!(target_os = "android") && - (*k == "RANDOM" || k.contains("-")) { - continue - } - - // Windows has hidden environment variables whose names start with - // equals signs (`=`). Those do not show up in the output of the - // `set` command. - assert!((cfg!(windows) && k.starts_with("=")) || - k.starts_with("DYLD") || - output.contains(&format!("{}={}", *k, *v)) || - output.contains(&format!("{}='{}'", *k, *v)), - "output doesn't contain `{}={}`\n{}", - k, v, output); - } - } - - #[test] fn test_override_env() { use env; |
