Skip to content

Commit cd1aa6e

Browse files
committed
run std tests on more targets
1 parent 70b560d commit cd1aa6e

File tree

2 files changed

+31
-11
lines changed

2 files changed

+31
-11
lines changed

src/bootstrap/mk/Makefile.in

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,20 @@ check-aux:
5353
src/tools/cargotest \
5454
$(BOOTSTRAP_ARGS)
5555
# Run standard library tests in Miri.
56+
# We use a 64bit little-endian and a 32bit big-endian target for max coverage.
5657
$(Q)$(BOOTSTRAP) miri --stage 2 \
58+
--target x86_64-unknown-linux-gnu,mips-unknown-linux-gnu \
5759
library/core \
5860
library/alloc \
5961
--no-doc
6062
# Some doctests have intentional memory leaks.
63+
# Also, they work only on the host.
6164
$(Q)MIRIFLAGS="-Zmiri-ignore-leaks -Zmiri-disable-isolation" \
6265
$(BOOTSTRAP) miri --stage 2 \
6366
library/core \
6467
library/alloc \
6568
--doc
66-
# In `std` we cannot test everything, so we test the most target-dependent modules.
69+
# In `std` we cannot test everything.
6770
$(Q)MIRIFLAGS="-Zmiri-disable-isolation" BOOTSTRAP_SKIP_TARGET_SANITY=1 \
6871
$(BOOTSTRAP) miri --stage 2 library/std \
6972
--no-doc -- \
@@ -72,6 +75,12 @@ check-aux:
7275
$(BOOTSTRAP) miri --stage 2 library/std \
7376
--doc -- \
7477
--skip fs:: --skip net:: --skip process:: --skip sys::pal::
78+
# Also test some very target-specific modules on other targets.
79+
$(Q)MIRIFLAGS="-Zmiri-disable-isolation" BOOTSTRAP_SKIP_TARGET_SANITY=1 \
80+
$(BOOTSTRAP) miri --stage 2 library/std \
81+
--target aarch64-apple-darwin,i686-pc-windows-gnu \
82+
--no-doc -- \
83+
time:: sync:: thread:: env::
7584
dist:
7685
$(Q)$(BOOTSTRAP) dist $(BOOTSTRAP_ARGS)
7786
distcheck:

src/bootstrap/src/core/build_steps/test.rs

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2658,16 +2658,27 @@ impl Step for Crate {
26582658

26592659
match mode {
26602660
Mode::Std => {
2661-
compile::std_cargo(builder, target, compiler.stage, &mut cargo);
2662-
// `std_cargo` actually does the wrong thing: it passes `--sysroot build/host/stage2`,
2663-
// but we want to use the force-recompile std we just built in `build/host/stage2-test-sysroot`.
2664-
// Override it.
2665-
if builder.download_rustc() && compiler.stage > 0 {
2666-
let sysroot = builder
2667-
.out
2668-
.join(compiler.host.triple)
2669-
.join(format!("stage{}-test-sysroot", compiler.stage));
2670-
cargo.env("RUSTC_SYSROOT", sysroot);
2661+
if builder.kind == Kind::Miri {
2662+
// We can't use `std_cargo` as that uses `optimized-compiler-builtins` which
2663+
// needs host tools for the given target. This is similar to what `compile::Std`
2664+
// does when `is_for_mir_opt_tests` is true. There's probably a chance for
2665+
// de-duplication here... `std_cargo` should support a mode that avoids needing
2666+
// host tools.
2667+
cargo
2668+
.arg("--manifest-path")
2669+
.arg(builder.src.join("library/sysroot/Cargo.toml"));
2670+
} else {
2671+
compile::std_cargo(builder, target, compiler.stage, &mut cargo);
2672+
// `std_cargo` actually does the wrong thing: it passes `--sysroot build/host/stage2`,
2673+
// but we want to use the force-recompile std we just built in `build/host/stage2-test-sysroot`.
2674+
// Override it.
2675+
if builder.download_rustc() && compiler.stage > 0 {
2676+
let sysroot = builder
2677+
.out
2678+
.join(compiler.host.triple)
2679+
.join(format!("stage{}-test-sysroot", compiler.stage));
2680+
cargo.env("RUSTC_SYSROOT", sysroot);
2681+
}
26712682
}
26722683
}
26732684
Mode::Rustc => {

0 commit comments

Comments
 (0)