From 0bde646b6f24a033c58bd1d84ab504b90a4565e1 Mon Sep 17 00:00:00 2001 From: Stepan Koltsov Date: Wed, 21 Jun 2017 15:05:27 +0300 Subject: [PATCH] Fix race in test_inherit_env `env` tests set (and unset) randomly generated variables with names starting with `TEST`. So in `test_inherit_env` between variable capture and process spawn `TEST*` variables can be unset if `env` tests executed concurrently. Thus `TEST*` variables must not be checked in that test. --- src/libstd/process.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/libstd/process.rs b/src/libstd/process.rs index 4c6d88c0ae889..8f43400739501 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -1418,6 +1418,15 @@ mod tests { continue } + // `env` tests set and unset randomly generated variables + // with names starting with `TEST`. So between variable capture + // and process spawn `TEST*` variables can be unset + // if `env` tests executed concurrently with this test. + // Thus `TEST*` variables must not be checked in this test. + if k.starts_with("TEST") { + continue; + } + // Windows has hidden environment variables whose names start with // equals signs (`=`). Those do not show up in the output of the // `set` command.