about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-06-17 18:27:30 +0200
committerGitHub <noreply@github.com>2023-06-17 18:27:30 +0200
commit9fff86619355f8fb28dc1211d1405ffdd0e0bd6e (patch)
treeb0e784fe1e50985c00b5d9bd3f0d326c52afd3f9
parentbe0f3bdc3e30e255adaaf50658f6d07dc3ea3897 (diff)
parent8d5e85607d3d52f920990334ae1cfa9798ad9259 (diff)
downloadrust-9fff86619355f8fb28dc1211d1405ffdd0e0bd6e.tar.gz
rust-9fff86619355f8fb28dc1211d1405ffdd0e0bd6e.zip
Rollup merge of #112435 - antoyo:allow-overwrite-sysroot, r=Mark-Simulacrum
Allow overwriting the sysroot compile flag via --rustc-args

Hi.
As discussed on [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/How.20to.20overwrite.20sysroot.20in.20x.2Epy.20test/near/364272269), this is a solution to allow the codegens to overwrite the sysroot as part of their test suite.
Thanks for the review.
-rw-r--r--src/tools/compiletest/src/runtest.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 8c744d5d3c4..25b16e38e53 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1951,7 +1951,9 @@ impl<'test> TestCx<'test> {
         rustc.arg("-Ztranslate-remapped-path-to-local-path=no");
 
         // Optionally prevent default --sysroot if specified in test compile-flags.
-        if !self.props.compile_flags.iter().any(|flag| flag.starts_with("--sysroot")) {
+        if !self.props.compile_flags.iter().any(|flag| flag.starts_with("--sysroot"))
+            && !self.config.host_rustcflags.iter().any(|flag| flag == "--sysroot")
+        {
             // In stage 0, make sure we use `stage0-sysroot` instead of the bootstrap sysroot.
             rustc.arg("--sysroot").arg(&self.config.sysroot_base);
         }