Skip to content

Commit 9f5fc1b

Browse files
committed
Auto merge of #115471 - RalfJung:skipping-sanity, r=onur-ozkan
also skip musl checks when BOOTSTRAP_SKIP_TARGET_SANITY is set Currently I cannot test musl targets in Miri via x.py; this PR fixes that.
2 parents c4f2577 + 9cae47e commit 9f5fc1b

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/bootstrap/sanity.rs

+13-10
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ impl Finder {
6262
}
6363

6464
pub fn check(build: &mut Build) {
65+
let skip_target_sanity =
66+
env::var_os("BOOTSTRAP_SKIP_TARGET_SANITY").is_some_and(|s| s == "1" || s == "true");
67+
6568
let path = env::var_os("PATH").unwrap_or_default();
6669
// On Windows, quotes are invalid characters for filename paths, and if
6770
// one is present as part of the PATH then that can lead to the system
@@ -166,7 +169,7 @@ than building it.
166169
// FIXME: it would be better to refactor this code to split necessary setup from pure sanity
167170
// checks, and have a regular flag for skipping the latter. Also see
168171
// <https://github.com/rust-lang/rust/pull/103569#discussion_r1008741742>.
169-
if env::var_os("BOOTSTRAP_SKIP_TARGET_SANITY").is_some() {
172+
if skip_target_sanity {
170173
continue;
171174
}
172175

@@ -205,7 +208,15 @@ than building it.
205208
}
206209
}
207210

208-
// Make sure musl-root is valid
211+
// Some environments don't want or need these tools, such as when testing Miri.
212+
// FIXME: it would be better to refactor this code to split necessary setup from pure sanity
213+
// checks, and have a regular flag for skipping the latter. Also see
214+
// <https://github.com/rust-lang/rust/pull/103569#discussion_r1008741742>.
215+
if skip_target_sanity {
216+
continue;
217+
}
218+
219+
// Make sure musl-root is valid.
209220
if target.contains("musl") && !target.contains("unikraft") {
210221
// If this is a native target (host is also musl) and no musl-root is given,
211222
// fall back to the system toolchain in /usr before giving up
@@ -227,14 +238,6 @@ than building it.
227238
}
228239
}
229240

230-
// Some environments don't want or need these tools, such as when testing Miri.
231-
// FIXME: it would be better to refactor this code to split necessary setup from pure sanity
232-
// checks, and have a regular flag for skipping the latter. Also see
233-
// <https://github.com/rust-lang/rust/pull/103569#discussion_r1008741742>.
234-
if env::var_os("BOOTSTRAP_SKIP_TARGET_SANITY").is_some() {
235-
continue;
236-
}
237-
238241
if need_cmake && target.contains("msvc") {
239242
// There are three builds of cmake on windows: MSVC, MinGW, and
240243
// Cygwin. The Cygwin build does not have generators for Visual

0 commit comments

Comments
 (0)