Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 43de44d

Browse files
committedMar 9, 2024
Respect COMPILETEST_FORCE_STAGE0 sysroot when compiling rmake.rs
1 parent b054da8 commit 43de44d

File tree

1 file changed

+36
-30
lines changed

1 file changed

+36
-30
lines changed
 

‎src/tools/compiletest/src/runtest.rs

+36-30
Original file line numberDiff line numberDiff line change
@@ -3803,36 +3803,42 @@ impl<'test> TestCx<'test> {
38033803
debug!(?support_lib_deps);
38043804
debug!(?support_lib_deps_deps);
38053805

3806-
let res = self.cmd2procres(
3807-
Command::new(&self.config.rustc_path)
3808-
.arg("-o")
3809-
.arg(&recipe_bin)
3810-
.arg(format!(
3811-
"-Ldependency={}",
3812-
&support_lib_path.parent().unwrap().to_string_lossy()
3813-
))
3814-
.arg(format!("-Ldependency={}", &support_lib_deps.to_string_lossy()))
3815-
.arg(format!("-Ldependency={}", &support_lib_deps_deps.to_string_lossy()))
3816-
.arg("--extern")
3817-
.arg(format!("run_make_support={}", &support_lib_path.to_string_lossy()))
3818-
.arg(&self.testpaths.file.join("rmake.rs"))
3819-
.env("TARGET", &self.config.target)
3820-
.env("PYTHON", &self.config.python)
3821-
.env("S", &src_root)
3822-
.env("RUST_BUILD_STAGE", &self.config.stage_id)
3823-
.env("RUSTC", cwd.join(&self.config.rustc_path))
3824-
.env("TMPDIR", &tmpdir)
3825-
.env("LD_LIB_PATH_ENVVAR", dylib_env_var())
3826-
.env("HOST_RPATH_DIR", cwd.join(&self.config.compile_lib_path))
3827-
.env("TARGET_RPATH_DIR", cwd.join(&self.config.run_lib_path))
3828-
.env("LLVM_COMPONENTS", &self.config.llvm_components)
3829-
// We for sure don't want these tests to run in parallel, so make
3830-
// sure they don't have access to these vars if we run via `make`
3831-
// at the top level
3832-
.env_remove("MAKEFLAGS")
3833-
.env_remove("MFLAGS")
3834-
.env_remove("CARGO_MAKEFLAGS"),
3835-
);
3806+
let mut cmd = Command::new(&self.config.rustc_path);
3807+
cmd.arg("-o")
3808+
.arg(&recipe_bin)
3809+
.arg(format!("-Ldependency={}", &support_lib_path.parent().unwrap().to_string_lossy()))
3810+
.arg(format!("-Ldependency={}", &support_lib_deps.to_string_lossy()))
3811+
.arg(format!("-Ldependency={}", &support_lib_deps_deps.to_string_lossy()))
3812+
.arg("--extern")
3813+
.arg(format!("run_make_support={}", &support_lib_path.to_string_lossy()))
3814+
.arg(&self.testpaths.file.join("rmake.rs"))
3815+
.env("TARGET", &self.config.target)
3816+
.env("PYTHON", &self.config.python)
3817+
.env("S", &src_root)
3818+
.env("RUST_BUILD_STAGE", &self.config.stage_id)
3819+
.env("RUSTC", cwd.join(&self.config.rustc_path))
3820+
.env("TMPDIR", &tmpdir)
3821+
.env("LD_LIB_PATH_ENVVAR", dylib_env_var())
3822+
.env("HOST_RPATH_DIR", cwd.join(&self.config.compile_lib_path))
3823+
.env("TARGET_RPATH_DIR", cwd.join(&self.config.run_lib_path))
3824+
.env("LLVM_COMPONENTS", &self.config.llvm_components)
3825+
// We for sure don't want these tests to run in parallel, so make
3826+
// sure they don't have access to these vars if we run via `make`
3827+
// at the top level
3828+
.env_remove("MAKEFLAGS")
3829+
.env_remove("MFLAGS")
3830+
.env_remove("CARGO_MAKEFLAGS");
3831+
3832+
if std::env::var_os("COMPILETEST_FORCE_STAGE0").is_some() {
3833+
let mut stage0_sysroot = build_root.clone();
3834+
stage0_sysroot.push("stage0-sysroot");
3835+
debug!(?stage0_sysroot);
3836+
debug!(exists = stage0_sysroot.exists());
3837+
3838+
cmd.arg("--sysroot").arg(&stage0_sysroot);
3839+
}
3840+
3841+
let res = self.cmd2procres(&mut cmd);
38363842
if !res.status.success() {
38373843
self.fatal_proc_rec("run-make test failed: could not build `rmake.rs` recipe", &res);
38383844
}

0 commit comments

Comments
 (0)