about summary refs log tree commit diff
path: root/src/tools/compiletest
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-05-08 08:26:48 +0000
committerbors <bors@rust-lang.org>2019-05-08 08:26:48 +0000
commitb92d360c6cf029bd98c154cb510ec9e11b39bad6 (patch)
tree4c3a4bbca11c0bfc68e57e27b5831e436bc9bb01 /src/tools/compiletest
parent33cde4aac2ec1b0a493d0acaa4c4fb45de0c6e94 (diff)
parent97ba4c95d00108ac79c86d2bbc6834b1fef008a2 (diff)
downloadrust-b92d360c6cf029bd98c154cb510ec9e11b39bad6.tar.gz
rust-b92d360c6cf029bd98c154cb510ec9e11b39bad6.zip
Auto merge of #60378 - froydnj:apple-target-modifications, r=michaelwoerister
conditionally modify darwin targets to macosx targets with versions

We need this behavior so that Rust LLVM IR objects match the target triple for Clang LLVM IR objects.  This matching then convinces the linker that yes, you really can do cross-language LTO with objects from different compilers.

The newly-added tests seem to pass locally on x86_64-unknown-linux-gnu.  I haven't done a full test run or tried the new compiler in an cross-language LTO setup yet.
Diffstat (limited to 'src/tools/compiletest')
-rw-r--r--src/tools/compiletest/src/header.rs8
-rw-r--r--src/tools/compiletest/src/runtest.rs3
2 files changed, 11 insertions, 0 deletions
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
index fb6ada89171..54e9b76a21e 100644
--- a/src/tools/compiletest/src/header.rs
+++ b/src/tools/compiletest/src/header.rs
@@ -305,6 +305,9 @@ pub struct TestProps {
     pub extern_private: Vec<String>,
     // Environment settings to use for compiling
     pub rustc_env: Vec<(String, String)>,
+    // Environment variables to unset prior to compiling.
+    // Variables are unset before applying 'rustc_env'.
+    pub unset_rustc_env: Vec<String>,
     // Environment settings to use during execution
     pub exec_env: Vec<(String, String)>,
     // Lines to check if they appear in the expected debugger output
@@ -373,6 +376,7 @@ impl TestProps {
             extern_private: vec![],
             revisions: vec![],
             rustc_env: vec![],
+            unset_rustc_env: vec![],
             exec_env: vec![],
             check_lines: vec![],
             build_aux_docs: false,
@@ -499,6 +503,10 @@ impl TestProps {
                 self.rustc_env.push(ee);
             }
 
+            if let Some(ev) = config.parse_name_value_directive(ln, "unset-rustc-env") {
+                self.unset_rustc_env.push(ev);
+            }
+
             if let Some(cl) = config.parse_check_line(ln) {
                 self.check_lines.push(cl);
             }
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 0e4946736fb..a11a4f17eb5 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1703,6 +1703,9 @@ impl<'test> TestCx<'test> {
             add_extern_priv(&private_lib, true);
         }
 
+        self.props.unset_rustc_env.clone()
+            .iter()
+            .fold(&mut rustc, |rustc, v| rustc.env_remove(v));
         rustc.envs(self.props.rustc_env.clone());
         self.compose_and_run(
             rustc,