Skip to content

Commit aa51b11

Browse files
committed
Auto merge of #11757 - ehuss:test-env-cleanup, r=epage
Scrub more of the test environment This adds a few environment variables that if set outside the testsuite will cause problems. This also has a separate commit which sorts the environment list.
2 parents 239ff78 + 0fcacd0 commit aa51b11

File tree

1 file changed

+22
-16
lines changed
  • crates/cargo-test-support/src

1 file changed

+22
-16
lines changed

crates/cargo-test-support/src/lib.rs

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,28 +1234,34 @@ pub trait TestEnv: Sized {
12341234
.env("__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS", "stable")
12351235
// Keeps cargo within its sandbox.
12361236
.env("__CARGO_TEST_DISABLE_GLOBAL_KNOWN_HOST", "1")
1237-
// For now disable incremental by default as support hasn't ridden to the
1238-
// stable channel yet. Once incremental support hits the stable compiler we
1239-
// can switch this to one and then fix the tests.
1237+
// Incremental generates a huge amount of data per test, which we
1238+
// don't particularly need. Tests that specifically need to check
1239+
// the incremental behavior should turn this back on.
12401240
.env("CARGO_INCREMENTAL", "0")
1241+
// Don't read the system git config which is out of our control.
1242+
.env("GIT_CONFIG_NOSYSTEM", "1")
12411243
.env_remove("__CARGO_DEFAULT_LIB_METADATA")
1242-
.env_remove("RUSTC")
1243-
.env_remove("RUSTDOC")
1244-
.env_remove("RUSTC_WRAPPER")
1245-
.env_remove("RUSTFLAGS")
1246-
.env_remove("RUSTDOCFLAGS")
1247-
.env_remove("XDG_CONFIG_HOME") // see #2345
1248-
.env("GIT_CONFIG_NOSYSTEM", "1") // keep trying to sandbox ourselves
1244+
.env_remove("ALL_PROXY")
12491245
.env_remove("EMAIL")
1250-
.env_remove("USER") // not set on some rust-lang docker images
1251-
.env_remove("MFLAGS")
1252-
.env_remove("MAKEFLAGS")
1253-
.env_remove("GIT_AUTHOR_NAME")
12541246
.env_remove("GIT_AUTHOR_EMAIL")
1255-
.env_remove("GIT_COMMITTER_NAME")
1247+
.env_remove("GIT_AUTHOR_NAME")
12561248
.env_remove("GIT_COMMITTER_EMAIL")
1249+
.env_remove("GIT_COMMITTER_NAME")
1250+
.env_remove("http_proxy")
1251+
.env_remove("HTTPS_PROXY")
1252+
.env_remove("https_proxy")
1253+
.env_remove("MAKEFLAGS")
1254+
.env_remove("MFLAGS")
1255+
.env_remove("MSYSTEM") // assume cmd.exe everywhere on windows
1256+
.env_remove("RUSTC")
1257+
.env_remove("RUSTC_WORKSPACE_WRAPPER")
1258+
.env_remove("RUSTC_WRAPPER")
1259+
.env_remove("RUSTDOC")
1260+
.env_remove("RUSTDOCFLAGS")
1261+
.env_remove("RUSTFLAGS")
12571262
.env_remove("SSH_AUTH_SOCK") // ensure an outer agent is never contacted
1258-
.env_remove("MSYSTEM"); // assume cmd.exe everywhere on windows
1263+
.env_remove("USER") // not set on some rust-lang docker images
1264+
.env_remove("XDG_CONFIG_HOME"); // see #2345
12591265
if cfg!(target_os = "macos") {
12601266
// Work-around a bug in macOS 10.15, see `link_or_copy` for details.
12611267
self = self.env("__CARGO_COPY_DONT_LINK_DO_NOT_USE_THIS", "1");

0 commit comments

Comments
 (0)