Skip to content

Commit

Permalink
Rollup merge of rust-lang#121907 - onur-ozkan:better-target-sanity-ch…
Browse files Browse the repository at this point in the history
…eck, r=albertlarsan68

skip sanity check for non-host targets in `check` builds

For `check` builds, since we only need to perform a sanity check on the host target, this patch skips target sanity checks on non-host targets.

For more context, see rust-lang#121519 (comment)

cc ``@saethlin``
  • Loading branch information
matthiaskrgr committed Mar 9, 2024
2 parents 5ea1672 + 489dcf2 commit 6e14b65
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/bootstrap/src/core/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use std::fs;
use std::path::PathBuf;
use std::process::Command;

use crate::builder::Kind;
use crate::core::config::Target;
use crate::utils::helpers::output;
use crate::Build;
Expand Down Expand Up @@ -64,6 +65,8 @@ pub fn check(build: &mut Build) {
let mut skip_target_sanity =
env::var_os("BOOTSTRAP_SKIP_TARGET_SANITY").is_some_and(|s| s == "1" || s == "true");

skip_target_sanity |= build.config.cmd.kind() == Kind::Check;

// Skip target sanity checks when we are doing anything with mir-opt tests or Miri
let skipped_paths = [OsStr::new("mir-opt"), OsStr::new("miri")];
skip_target_sanity |= build.config.paths.iter().any(|path| {
Expand Down Expand Up @@ -169,11 +172,7 @@ than building it.
continue;
}

// Some environments don't want or need these tools, such as when testing Miri.
// FIXME: it would be better to refactor this code to split necessary setup from pure sanity
// checks, and have a regular flag for skipping the latter. Also see
// <https://github.com/rust-lang/rust/pull/103569#discussion_r1008741742>.
if skip_target_sanity {
if skip_target_sanity && target != &build.build {
continue;
}

Expand Down Expand Up @@ -215,11 +214,7 @@ than building it.
panic!("All the *-none-* and nvptx* targets are no-std targets")
}

// Some environments don't want or need these tools, such as when testing Miri.
// FIXME: it would be better to refactor this code to split necessary setup from pure sanity
// checks, and have a regular flag for skipping the latter. Also see
// <https://github.com/rust-lang/rust/pull/103569#discussion_r1008741742>.
if skip_target_sanity {
if skip_target_sanity && target != &build.build {
continue;
}

Expand Down

0 comments on commit 6e14b65

Please sign in to comment.