about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2018-03-11 13:15:46 -0700
committerAlex Crichton <alex@alexcrichton.com>2018-03-11 13:15:46 -0700
commit9a3128ec1d603dfa87de5db8eccff08d6dd62f67 (patch)
tree21504d53ac8d25660bbf2740b597a87ed15183e9
parent5f2efb09358c1c43ff0f8be11c00948478777e23 (diff)
downloadrust-9a3128ec1d603dfa87de5db8eccff08d6dd62f67.tar.gz
rust-9a3128ec1d603dfa87de5db8eccff08d6dd62f67.zip
test: Forcibly remove MAKEFLAGS in compiletest
When executing run-make tests we run a risk of leaking the `MAKEFLAGS`
environment variable if `./x.py` itself was called from `make` (aka `make check
-j3` as the OSX bots do). We may then leak accidentally fds into the child
process and trick it into thinking it's got a jobserver!

Hopefully addresses [this] spurious failure

[this]: https://github.com/rust-lang/rust/pull/48295#issuecomment-372134717
-rw-r--r--src/tools/compiletest/src/runtest.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index d3f571dd8ae..6619838cce0 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -2412,7 +2412,14 @@ impl<'test> TestCx<'test> {
             .env("HOST_RPATH_DIR", cwd.join(&self.config.compile_lib_path))
             .env("TARGET_RPATH_DIR", cwd.join(&self.config.run_lib_path))
             .env("LLVM_COMPONENTS", &self.config.llvm_components)
-            .env("LLVM_CXXFLAGS", &self.config.llvm_cxxflags);
+            .env("LLVM_CXXFLAGS", &self.config.llvm_cxxflags)
+
+            // We for sure don't want these tests to run in parallel, so make
+            // sure they don't have access to these vars if we we run via `make`
+            // at the top level
+            .env_remove("MAKEFLAGS")
+            .env_remove("MFLAGS")
+            .env_remove("CARGO_MAKEFLAGS");
 
         if let Some(ref linker) = self.config.linker {
             cmd.env("RUSTC_LINKER", linker);