Skip to content
/ rust Public
forked from rust-lang/rust
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 29b0f25

Browse files
authoredMar 11, 2024
Rollup merge of rust-lang#121907 - onur-ozkan:better-target-sanity-check, 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`
2 parents 61ff631 + e5e1fa6 commit 29b0f25

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed
 

‎src/bootstrap/src/core/sanity.rs

+7-10
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use std::fs;
1515
use std::path::PathBuf;
1616
use std::process::Command;
1717

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

68+
skip_target_sanity |= build.config.cmd.kind() == Kind::Check;
69+
6770
// Skip target sanity checks when we are doing anything with mir-opt tests or Miri
6871
let skipped_paths = [OsStr::new("mir-opt"), OsStr::new("miri")];
6972
skip_target_sanity |= build.config.paths.iter().any(|path| {
@@ -169,11 +172,8 @@ than building it.
169172
continue;
170173
}
171174

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

@@ -215,11 +215,8 @@ than building it.
215215
panic!("All the *-none-* and nvptx* targets are no-std targets")
216216
}
217217

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

0 commit comments

Comments
 (0)
Please sign in to comment.