Skip to content

Commit 56d08d1

Browse files
authored
Rollup merge of #110584 - ferrocene:comptest-sysroot-arg, r=oli-obk
Allow overwriting the sysroot compile flag in compile tests This was added in https://github.com/rust-lang/rust/pull/110478/files#diff-03a0567fa80ca04ed5a55f9ac5c711b4f84659be2d0ac4a984196d581c04f76b, unconditionally passing the `sysroot` flag to the compile test invocations. In our ferrocene fork we have a few tests that test the `sysroot` flag specifically which fail due to the flag being passed multiple times now. We believe upstreaming this small change could be beneficial should the rust-lang/rust also want to test certain sysroot setups in the future.
2 parents e2ad167 + e434b5b commit 56d08d1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/tools/compiletest/src/runtest.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1900,8 +1900,11 @@ impl<'test> TestCx<'test> {
19001900
// Use a single thread for efficiency and a deterministic error message order
19011901
rustc.arg("-Zthreads=1");
19021902

1903-
// In stage 0, make sure we use `stage0-sysroot` instead of the bootstrap sysroot.
1904-
rustc.arg("--sysroot").arg(&self.config.sysroot_base);
1903+
// Optionally prevent default --sysroot if specified in test compile-flags.
1904+
if !self.props.compile_flags.iter().any(|flag| flag.starts_with("--sysroot")) {
1905+
// In stage 0, make sure we use `stage0-sysroot` instead of the bootstrap sysroot.
1906+
rustc.arg("--sysroot").arg(&self.config.sysroot_base);
1907+
}
19051908

19061909
// Optionally prevent default --target if specified in test compile-flags.
19071910
let custom_target = self.props.compile_flags.iter().any(|x| x.starts_with("--target"));

0 commit comments

Comments
 (0)