Skip to content

Fix race in test_inherit_env #42795

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all 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
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.
  • Loading branch information
stepancheg committed Jun 21, 2017
commit 0bde646b6f24a033c58bd1d84ab504b90a4565e1
9 changes: 9 additions & 0 deletions src/libstd/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down