Respect COMPILETEST_FORCE_STAGE0 sysroot when compiling rmake.rs

This commit is contained in:
许杰友 Jieyou Xu (Joe) 2024-03-09 18:01:42 +00:00
parent b054da8155
commit 43de44d538
No known key found for this signature in database
GPG Key ID: 95DDEBD74A1DC2C0

View File

@ -3803,14 +3803,10 @@ fn run_rmake_v2_test(&self) {
debug!(?support_lib_deps);
debug!(?support_lib_deps_deps);
let res = self.cmd2procres(
Command::new(&self.config.rustc_path)
.arg("-o")
let mut cmd = Command::new(&self.config.rustc_path);
cmd.arg("-o")
.arg(&recipe_bin)
.arg(format!(
"-Ldependency={}",
&support_lib_path.parent().unwrap().to_string_lossy()
))
.arg(format!("-Ldependency={}", &support_lib_path.parent().unwrap().to_string_lossy()))
.arg(format!("-Ldependency={}", &support_lib_deps.to_string_lossy()))
.arg(format!("-Ldependency={}", &support_lib_deps_deps.to_string_lossy()))
.arg("--extern")
@ -3831,8 +3827,18 @@ fn run_rmake_v2_test(&self) {
// at the top level
.env_remove("MAKEFLAGS")
.env_remove("MFLAGS")
.env_remove("CARGO_MAKEFLAGS"),
);
.env_remove("CARGO_MAKEFLAGS");
if std::env::var_os("COMPILETEST_FORCE_STAGE0").is_some() {
let mut stage0_sysroot = build_root.clone();
stage0_sysroot.push("stage0-sysroot");
debug!(?stage0_sysroot);
debug!(exists = stage0_sysroot.exists());
cmd.arg("--sysroot").arg(&stage0_sysroot);
}
let res = self.cmd2procres(&mut cmd);
if !res.status.success() {
self.fatal_proc_rec("run-make test failed: could not build `rmake.rs` recipe", &res);
}