Skip to content

Commit fce4134

Browse files
authored
Merge pull request #56 from RalfJung/nofake
redo ./run-test.sh based on MIRI_REPLACE_LIBRS_IF_NOT_TEST
2 parents a0937b2 + df1be8b commit fce4134

File tree

24 files changed

+86
-203
lines changed

24 files changed

+86
-203
lines changed

Cargo.toml

+14-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
1+
# We set up our own workspace that contains the library crates.
2+
# `./run-test.sh` makes the `library` folder a symlink to the right place.
3+
# (Somehow, directly building things from `rustlib/src` does not work...)
14
[workspace]
25
members = [
3-
"core_miri_test",
4-
"alloc_miri_test",
5-
"std_miri_test",
6+
"library/std",
7+
"library/sysroot",
68
]
79

810
exclude = [
911
# stdarch has its own Cargo workspace
1012
"library/stdarch",
11-
"rust-src-patched/library/stdarch",
13+
# this is just a staging ground for CI
14+
"rust-src-patched",
1215
]
16+
17+
[patch.crates-io]
18+
# See comments in `library/rustc-std-workspace-core/README.md` for what's going on
19+
# here
20+
rustc-std-workspace-core = { path = 'library/rustc-std-workspace-core' }
21+
rustc-std-workspace-alloc = { path = 'library/rustc-std-workspace-alloc' }
22+
rustc-std-workspace-std = { path = 'library/rustc-std-workspace-std' }

alloc_miri_test/Cargo.toml

-29
This file was deleted.

ci-test.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,10 @@ std)
8585
echo "::endgroup::"
8686
;;
8787
simd)
88-
cd $MIRI_LIB_SRC/portable-simd
88+
export CARGO_TARGET_DIR=$(pwd)/target
8989
export RUSTFLAGS="-Ainternal_features ${RUSTFLAGS:-}"
9090
export RUSTDOCFLAGS="-Ainternal_features ${RUSTDOCFLAGS:-}"
91+
cd $MIRI_LIB_SRC/portable-simd
9192

9293
echo "::group::Testing portable-simd"
9394
MIRIFLAGS="$DEFAULTFLAGS" \

core_miri_test/Cargo.toml

-31
This file was deleted.

fake/README.md

-2
This file was deleted.

fake/alloc/Cargo.toml

-7
This file was deleted.

fake/alloc/lib.rs

-9
This file was deleted.

fake/cfg-if/Cargo.toml

-7
This file was deleted.

fake/cfg-if/lib.rs

-3
This file was deleted.

fake/core/Cargo.toml

-7
This file was deleted.

fake/core/lib.rs

-5
This file was deleted.

fake/hashbrown/Cargo.toml

-7
This file was deleted.

fake/hashbrown/lib.rs

-3
This file was deleted.

fake/libc/Cargo.toml

-7
This file was deleted.

fake/libc/lib.rs

-3
This file was deleted.

fake/rustc-demangle/Cargo.toml

-7
This file was deleted.

fake/rustc-demangle/lib.rs

-3
This file was deleted.

fake/std_detect/Cargo.toml

-7
This file was deleted.

fake/std_detect/lib.rs

-4
This file was deleted.

run-stdarch-test.sh

+6-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -euo pipefail
66
## Usage:
77
## ./run-test.sh TARGET
88
## Environment variables:
9-
## MIRI_LIB_SRC: The path to the Rust library directory (`library`).
9+
## MIRI_LIB_SRC: The path to the Rust `library` directory (optional).
1010
## RUSTFLAGS: rustc flags (optional)
1111
## MIRIFLAGS: Miri flags (optional)
1212

@@ -40,8 +40,11 @@ export STDARCH_TEST_EVERYTHING=1
4040
# Needed to pass the STDARCH_TEST_EVERYTHING environment variable
4141
export MIRIFLAGS="${MIRIFLAGS:-} -Zmiri-disable-isolation"
4242

43-
cd $MIRI_LIB_SRC/stdarch
43+
# Set library source dir
44+
export MIRI_LIB_SRC=${MIRI_LIB_SRC:-$(rustc --print sysroot)/lib/rustlib/src/rust/library}
45+
46+
export CARGO_TARGET_DIR=$(pwd)/target
4447
cargo miri test \
48+
--manifest-path=$MIRI_LIB_SRC/stdarch/crates/core_arch/Cargo.toml \
4549
--target "$TARGET" \
46-
--manifest-path=crates/core_arch/Cargo.toml \
4750
-- "${TEST_ARGS[@]}"

run-test.sh

+6-2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ ln -s "$MIRI_LIB_SRC" library
3535
# use the rust-src lockfile
3636
cp "$MIRI_LIB_SRC/../Cargo.lock" Cargo.lock
3737

38+
# This ensures that the "core" crate being built as part of `cargo miri test`
39+
# is just a re-export of the sysroot crate, so we don't get duplicate lang items.
40+
export MIRI_REPLACE_LIBRS_IF_NOT_TEST=1
41+
3842
# run test
39-
cd ./${CRATE}_miri_test
40-
cargo miri test "$@"
43+
export CARGO_TARGET_DIR=$(pwd)/target
44+
cargo miri test --manifest-path "library/$CRATE/Cargo.toml" "$@"

rust-src.diff

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
diff --git a/library/alloc/benches/lib.rs b/library/alloc/benches/lib.rs
2+
index 638f343fb24..0561f49c967 100644
3+
--- a/library/alloc/benches/lib.rs
4+
+++ b/library/alloc/benches/lib.rs
5+
@@ -1,6 +1,8 @@
6+
// Disabling on android for the time being
7+
// See https://github.com/rust-lang/rust/issues/73535#event-3477699747
8+
#![cfg(not(target_os = "android"))]
9+
+// Disabling in Miri as these would take too long.
10+
+#![cfg(not(miri))]
11+
#![feature(btree_extract_if)]
12+
#![feature(iter_next_chunk)]
13+
#![feature(repr_simd)]
14+
diff --git a/library/core/benches/lib.rs b/library/core/benches/lib.rs
15+
index 4d14b930e41..32d15c386cb 100644
16+
--- a/library/core/benches/lib.rs
17+
+++ b/library/core/benches/lib.rs
18+
@@ -1,5 +1,7 @@
19+
// wasm32 does not support benches (no time).
20+
#![cfg(not(target_arch = "wasm32"))]
21+
+// Disabling in Miri as these would take too long.
22+
+#![cfg(not(miri))]
23+
#![feature(flt2dec)]
24+
#![feature(test)]
25+
#![feature(trusted_random_access)]
26+
diff --git a/library/std/benches/lib.rs b/library/std/benches/lib.rs
27+
index 4d1cf7fab7b..1b21c230a0b 100644
28+
--- a/library/std/benches/lib.rs
29+
+++ b/library/std/benches/lib.rs
30+
@@ -1,3 +1,5 @@
31+
+// Disabling in Miri as these would take too long.
32+
+#![cfg(not(miri))]
33+
#![feature(test)]
34+
35+
extern crate test;
36+
diff --git a/library/std/tests/process_spawning.rs b/library/std/tests/process_spawning.rs
37+
index 59f67f9901f..2b7997299c5 100644
38+
--- a/library/std/tests/process_spawning.rs
39+
+++ b/library/std/tests/process_spawning.rs
40+
@@ -1,4 +1,6 @@
41+
#![cfg(not(target_env = "sgx"))]
42+
+// Process spawning does not work in Miri.
43+
+#![cfg(not(miri))]
44+
45+
use std::env;
46+
use std::fs;
47+
diff --git a/library/std/tests/switch-stdout.rs b/library/std/tests/switch-stdout.rs
48+
index 27f3e8a9b96..a80f24fcb19 100644
49+
--- a/library/std/tests/switch-stdout.rs
50+
+++ b/library/std/tests/switch-stdout.rs
51+
@@ -1,4 +1,6 @@
52+
#![cfg(any(target_family = "unix", target_family = "windows"))]
53+
+// Calls functions that are not supported by Miri.
54+
+#![cfg(not(miri))]
55+
56+
use std::fs::File;
57+
use std::io::{Read, Write};

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nightly-2024-04-01
1+
nightly-2024-04-06

std_miri_test/Cargo.toml

-51
This file was deleted.

0 commit comments

Comments
 (0)