Rollup merge of #130261 - onur-ozkan:#130242, r=Kobzol

skip target sanity check when it's a `local-rebuild`

Running the stage0 target sanity check on the newly built compiler can result in errors and incorrect assumptions.

Resolves #130242
This commit is contained in:
Stuart Cook 2024-09-13 19:38:00 +10:00 committed by GitHub
commit 26bda05938
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 8 deletions

View File

@ -233,7 +233,8 @@ pub fn check(build: &mut Build) {
} }
// Ignore fake targets that are only used for unit tests in bootstrap. // Ignore fake targets that are only used for unit tests in bootstrap.
if cfg!(not(feature = "bootstrap-self-test")) && !skip_target_sanity { if cfg!(not(feature = "bootstrap-self-test")) && !skip_target_sanity && !build.local_rebuild
{
let mut has_target = false; let mut has_target = false;
let target_str = target.to_string(); let target_str = target.to_string();

View File

@ -67,6 +67,7 @@ pub fn run_tests(env: &Environment) -> anyhow::Result<()> {
[build] [build]
rustc = "{rustc}" rustc = "{rustc}"
cargo = "{cargo}" cargo = "{cargo}"
local-rebuild = true
[target.{host_triple}] [target.{host_triple}]
llvm-config = "{llvm_config}" llvm-config = "{llvm_config}"
@ -102,13 +103,7 @@ pub fn run_tests(env: &Environment) -> anyhow::Result<()> {
for test_path in env.skipped_tests() { for test_path in env.skipped_tests() {
args.extend(["--skip", test_path]); args.extend(["--skip", test_path]);
} }
cmd(&args) cmd(&args).env("COMPILETEST_FORCE_STAGE0", "1").run().context("Cannot execute tests")
.env("COMPILETEST_FORCE_STAGE0", "1")
// Above we override the stage 0 compiler with previously compiled compiler,
// which can cause confusion in bootstrap's target sanity checks.
.env("BOOTSTRAP_SKIP_TARGET_SANITY", "1")
.run()
.context("Cannot execute tests")
} }
/// Tries to find the version of the dist artifacts (either nightly, beta, or 1.XY.Z). /// Tries to find the version of the dist artifacts (either nightly, beta, or 1.XY.Z).