Skip to content

Commit d9284af

Browse files
committedJul 14, 2024
Auto merge of rust-lang#127726 - RalfJung:miri-sync, r=RalfJung
Miri subtree update r? `@ghost`
2 parents f8e4ac0 + e90f047 commit d9284af

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1531
-277
lines changed
 

‎src/tools/miri/cargo-miri/src/phases.rs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,17 @@ pub fn phase_cargo_miri(mut args: impl Iterator<Item = String>) {
104104
miri_for_host()
105105
)
106106
});
107-
let host = &rustc_version.host;
108-
let target = get_arg_flag_value("--target");
109-
let target = target.as_ref().unwrap_or(host);
107+
let mut targets = get_arg_flag_values("--target").collect::<Vec<_>>();
108+
// If `targets` is empty, we need to add a `--target $HOST` flag ourselves, and also ensure
109+
// that the host target is indeed setup.
110+
let target_flag = if targets.is_empty() {
111+
let host = &rustc_version.host;
112+
targets.push(host.clone());
113+
Some(host)
114+
} else {
115+
// We don't need to add a `--target` flag, we just forward the user's flags.
116+
None
117+
};
110118

111119
// If cleaning the target directory & sysroot cache,
112120
// delete them then exit. There is no reason to setup a new
@@ -118,8 +126,11 @@ pub fn phase_cargo_miri(mut args: impl Iterator<Item = String>) {
118126
return;
119127
}
120128

121-
// We always setup.
122-
let miri_sysroot = setup(&subcommand, target, &rustc_version, verbose, quiet);
129+
for target in &targets {
130+
// We always setup.
131+
setup(&subcommand, target.as_str(), &rustc_version, verbose, quiet);
132+
}
133+
let miri_sysroot = get_sysroot_dir();
123134

124135
// Invoke actual cargo for the job, but with different flags.
125136
// We re-use `cargo test` and `cargo run`, which makes target and binary handling very easy but
@@ -155,10 +166,9 @@ pub fn phase_cargo_miri(mut args: impl Iterator<Item = String>) {
155166
// This is needed to make the `target.runner` settings do something,
156167
// and it later helps us detect which crates are proc-macro/build-script
157168
// (host crates) and which crates are needed for the program itself.
158-
if get_arg_flag_value("--target").is_none() {
159-
// No target given. Explicitly pick the host.
169+
if let Some(target_flag) = target_flag {
160170
cmd.arg("--target");
161-
cmd.arg(host);
171+
cmd.arg(target_flag);
162172
}
163173

164174
// Set ourselves as runner for al binaries invoked by cargo.

‎src/tools/miri/ci/ci.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ function run_tests {
4141
if [ -n "${TEST_TARGET-}" ]; then
4242
begingroup "Testing foreign architecture $TEST_TARGET"
4343
TARGET_FLAG="--target $TEST_TARGET"
44+
MULTI_TARGET_FLAG=""
4445
else
4546
begingroup "Testing host architecture"
4647
TARGET_FLAG=""
48+
MULTI_TARGET_FLAG="--multi-target"
4749
fi
4850

4951
## ui test suite
@@ -93,7 +95,7 @@ function run_tests {
9395
echo 'build.rustc-wrapper = "thisdoesnotexist"' > .cargo/config.toml
9496
fi
9597
# Run the actual test
96-
time ${PYTHON} test-cargo-miri/run-test.py $TARGET_FLAG
98+
time ${PYTHON} test-cargo-miri/run-test.py $TARGET_FLAG $MULTI_TARGET_FLAG
9799
# Clean up
98100
unset RUSTC MIRI
99101
rm -rf .cargo

0 commit comments

Comments
 (0)
Please sign in to comment.