Skip to content

redo ./run-test.sh based on MIRI_REPLACE_LIBRS_IF_NOT_TEST #56

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 1 commit into from
Apr 6, 2024
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
18 changes: 14 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
# We set up our own workspace that contains the library crates.
# `./run-test.sh` makes the `library` folder a symlink to the right place.
# (Somehow, directly building things from `rustlib/src` does not work...)
[workspace]
members = [
"core_miri_test",
"alloc_miri_test",
"std_miri_test",
"library/std",
"library/sysroot",
]

exclude = [
# stdarch has its own Cargo workspace
"library/stdarch",
"rust-src-patched/library/stdarch",
# this is just a staging ground for CI
"rust-src-patched",
]

[patch.crates-io]
# See comments in `library/rustc-std-workspace-core/README.md` for what's going on
# here
rustc-std-workspace-core = { path = 'library/rustc-std-workspace-core' }
rustc-std-workspace-alloc = { path = 'library/rustc-std-workspace-alloc' }
rustc-std-workspace-std = { path = 'library/rustc-std-workspace-std' }
29 changes: 0 additions & 29 deletions alloc_miri_test/Cargo.toml

This file was deleted.

3 changes: 2 additions & 1 deletion ci-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ std)
echo "::endgroup::"
;;
simd)
cd $MIRI_LIB_SRC/portable-simd
export CARGO_TARGET_DIR=$(pwd)/target
export RUSTFLAGS="-Ainternal_features ${RUSTFLAGS:-}"
export RUSTDOCFLAGS="-Ainternal_features ${RUSTDOCFLAGS:-}"
cd $MIRI_LIB_SRC/portable-simd

echo "::group::Testing portable-simd"
MIRIFLAGS="$DEFAULTFLAGS" \
Expand Down
31 changes: 0 additions & 31 deletions core_miri_test/Cargo.toml

This file was deleted.

2 changes: 0 additions & 2 deletions fake/README.md

This file was deleted.

7 changes: 0 additions & 7 deletions fake/alloc/Cargo.toml

This file was deleted.

9 changes: 0 additions & 9 deletions fake/alloc/lib.rs

This file was deleted.

7 changes: 0 additions & 7 deletions fake/cfg-if/Cargo.toml

This file was deleted.

3 changes: 0 additions & 3 deletions fake/cfg-if/lib.rs

This file was deleted.

7 changes: 0 additions & 7 deletions fake/core/Cargo.toml

This file was deleted.

5 changes: 0 additions & 5 deletions fake/core/lib.rs

This file was deleted.

7 changes: 0 additions & 7 deletions fake/hashbrown/Cargo.toml

This file was deleted.

3 changes: 0 additions & 3 deletions fake/hashbrown/lib.rs

This file was deleted.

7 changes: 0 additions & 7 deletions fake/libc/Cargo.toml

This file was deleted.

3 changes: 0 additions & 3 deletions fake/libc/lib.rs

This file was deleted.

7 changes: 0 additions & 7 deletions fake/rustc-demangle/Cargo.toml

This file was deleted.

3 changes: 0 additions & 3 deletions fake/rustc-demangle/lib.rs

This file was deleted.

7 changes: 0 additions & 7 deletions fake/std_detect/Cargo.toml

This file was deleted.

4 changes: 0 additions & 4 deletions fake/std_detect/lib.rs

This file was deleted.

9 changes: 6 additions & 3 deletions run-stdarch-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -euo pipefail
## Usage:
## ./run-test.sh TARGET
## Environment variables:
## MIRI_LIB_SRC: The path to the Rust library directory (`library`).
## MIRI_LIB_SRC: The path to the Rust `library` directory (optional).
## RUSTFLAGS: rustc flags (optional)
## MIRIFLAGS: Miri flags (optional)

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

cd $MIRI_LIB_SRC/stdarch
# Set library source dir
export MIRI_LIB_SRC=${MIRI_LIB_SRC:-$(rustc --print sysroot)/lib/rustlib/src/rust/library}

export CARGO_TARGET_DIR=$(pwd)/target
cargo miri test \
--manifest-path=$MIRI_LIB_SRC/stdarch/crates/core_arch/Cargo.toml \
--target "$TARGET" \
--manifest-path=crates/core_arch/Cargo.toml \
-- "${TEST_ARGS[@]}"
8 changes: 6 additions & 2 deletions run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ ln -s "$MIRI_LIB_SRC" library
# use the rust-src lockfile
cp "$MIRI_LIB_SRC/../Cargo.lock" Cargo.lock

# This ensures that the "core" crate being built as part of `cargo miri test`
# is just a re-export of the sysroot crate, so we don't get duplicate lang items.
export MIRI_REPLACE_LIBRS_IF_NOT_TEST=1

# run test
cd ./${CRATE}_miri_test
cargo miri test "$@"
export CARGO_TARGET_DIR=$(pwd)/target
cargo miri test --manifest-path "library/$CRATE/Cargo.toml" "$@"
57 changes: 57 additions & 0 deletions rust-src.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
diff --git a/library/alloc/benches/lib.rs b/library/alloc/benches/lib.rs
index 638f343fb24..0561f49c967 100644
--- a/library/alloc/benches/lib.rs
+++ b/library/alloc/benches/lib.rs
@@ -1,6 +1,8 @@
// Disabling on android for the time being
// See https://github.com/rust-lang/rust/issues/73535#event-3477699747
#![cfg(not(target_os = "android"))]
+// Disabling in Miri as these would take too long.
+#![cfg(not(miri))]
#![feature(btree_extract_if)]
#![feature(iter_next_chunk)]
#![feature(repr_simd)]
diff --git a/library/core/benches/lib.rs b/library/core/benches/lib.rs
index 4d14b930e41..32d15c386cb 100644
--- a/library/core/benches/lib.rs
+++ b/library/core/benches/lib.rs
@@ -1,5 +1,7 @@
// wasm32 does not support benches (no time).
#![cfg(not(target_arch = "wasm32"))]
+// Disabling in Miri as these would take too long.
+#![cfg(not(miri))]
#![feature(flt2dec)]
#![feature(test)]
#![feature(trusted_random_access)]
diff --git a/library/std/benches/lib.rs b/library/std/benches/lib.rs
index 4d1cf7fab7b..1b21c230a0b 100644
--- a/library/std/benches/lib.rs
+++ b/library/std/benches/lib.rs
@@ -1,3 +1,5 @@
+// Disabling in Miri as these would take too long.
+#![cfg(not(miri))]
#![feature(test)]

extern crate test;
diff --git a/library/std/tests/process_spawning.rs b/library/std/tests/process_spawning.rs
index 59f67f9901f..2b7997299c5 100644
--- a/library/std/tests/process_spawning.rs
+++ b/library/std/tests/process_spawning.rs
@@ -1,4 +1,6 @@
#![cfg(not(target_env = "sgx"))]
+// Process spawning does not work in Miri.
+#![cfg(not(miri))]

use std::env;
use std::fs;
diff --git a/library/std/tests/switch-stdout.rs b/library/std/tests/switch-stdout.rs
index 27f3e8a9b96..a80f24fcb19 100644
--- a/library/std/tests/switch-stdout.rs
+++ b/library/std/tests/switch-stdout.rs
@@ -1,4 +1,6 @@
#![cfg(any(target_family = "unix", target_family = "windows"))]
+// Calls functions that are not supported by Miri.
+#![cfg(not(miri))]

use std::fs::File;
use std::io::{Read, Write};
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2024-04-01
nightly-2024-04-06
51 changes: 0 additions & 51 deletions std_miri_test/Cargo.toml

This file was deleted.