Skip to content

fix and (re-)enable Miri cross-target checks on macOS and Windows #103569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/bootstrap/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,14 @@ 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 env::var_os("BOOTSTRAP_SKIP_TARGET_SANITY").is_some() {
continue;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's other checks similar to this (e.g., the cmake check for msvc below). I think my recommendation would be to see if we can refactor the sanity checking as a whole so there's a x.py flag that disables it. I think skipping it entirely won't work today, but if we move some of the detection logic to config.rs that might fix it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That will probably require more digging into x.py than I will have time for, unfortunately.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright. I can probably make an attempt to do that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added another check of BOOTSTRAP_SKIP_TARGET_SANITY to the second loop that iterates all targets, which could help in the interim. (When writing this PR I did not notice there are two such loops.)


if !build.config.dry_run {
cmd_finder.must_have(build.cc(*target));
if let Some(ar) = build.ar(*target) {
Expand Down Expand Up @@ -212,6 +220,14 @@ than building it.
}
}

// 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 env::var_os("BOOTSTRAP_SKIP_TARGET_SANITY").is_some() {
continue;
}

if need_cmake && target.contains("msvc") {
// There are three builds of cmake on windows: MSVC, MinGW, and
// Cygwin. The Cygwin build does not have generators for Visual
Expand Down
11 changes: 4 additions & 7 deletions src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ python3 "$X_PY" test --stage 2 src/tools/rustfmt
python3 "$X_PY" test --stage 2 src/tools/miri
# We natively run this script on x86_64-unknown-linux-gnu and x86_64-pc-windows-msvc.
# Also cover some other targets (on both of these hosts) via cross-testing.
#
# Currently disabled -- we end up pulling in a cross-compile of LLVM (maybe
# just overly eager sanity checks), but in any case this won't work when
# building LLVM as of this comment.
#python3 "$X_PY" test --stage 2 src/tools/miri --target i686-pc-windows-msvc
#FIXME(https://github.com/rust-lang/rust/issues/103519): macOS testing is currently disabled
# python3 "$X_PY" test --stage 2 src/tools/miri --target aarch64-apple-darwin
export BOOTSTRAP_SKIP_TARGET_SANITY=1 # we don't need `cc` for these targets
python3 "$X_PY" test --stage 2 src/tools/miri --target i686-pc-windows-msvc
python3 "$X_PY" test --stage 2 src/tools/miri --target aarch64-apple-darwin
unset BOOTSTRAP_SKIP_TARGET_SANITY