Skip to content
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ If you are getting strange build errors, `cargo clean` can often fix that.

If you want to know how long each test took to execute, add `2>&1 | ts -m -i '%.s '` to the end of the command,
or use the test flags `-Zunstable-options --report-time` (the latter option also requires `-Zmiri-disable-isolation` in the Miri flags).

You can also tell `run-test.sh` to use nextest by setting `USE_NEXTEST=1`.
Note however that this will be a lot [slower](https://github.com/rust-lang/miri/issues/5013) than regular test execution.
2 changes: 1 addition & 1 deletion ci-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -euo pipefail
sudo apt-get -y install moreutils
echo

# And of course we need Rust
# And of course we need Rust with Miri
if [[ "$GITHUB_EVENT_NAME" == 'schedule' ]]; then
RUST_TOOLCHAIN=nightly
else
Expand Down
4 changes: 4 additions & 0 deletions ci-test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash
set -euo pipefail

# Miri flags we apply everywhere
DEFAULTFLAGS="-Zrandomize-layout -Zmiri-strict-provenance"

# make sure we keep using the current toolchain even in subdirs that have a toolchain file
Expand All @@ -12,6 +13,9 @@ cp -a $(rustc --print sysroot)/lib/rustlib/src/rust/ rust-src-patched
( cd rust-src-patched && patch -f -p1 < ../rust-src.diff >/dev/null ) || ( echo "Applying rust-src.diff failed!" && exit 1 )
export MIRI_LIB_SRC=$(pwd)/rust-src-patched/library

# We're not using nextest as that's very slow due to
# <https://github.com/rust-lang/miri/issues/5013>.

# run the tests (some also without validation, to exercise those code paths in Miri)
case "$1" in
core)
Expand Down
7 changes: 6 additions & 1 deletion run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ set -euo pipefail
## Environment variables:
## MIRI_LIB_SRC: The path to the Rust library directory (`library`).
## Defaults to `$(rustc --print sysroot)/lib/rustlib/src/rust/library`.
## USE_NEXTEST: If non-empty, run `cargo miri nextest run` instead of `cargo miri test`.

CRATE=${1:-}
if [[ -z "$CRATE" ]]; then
Expand Down Expand Up @@ -39,4 +40,8 @@ export RUSTDOCFLAGS="${RUSTDOCFLAGS:-} $EXTRAFLAGS"

# run test
export CARGO_TARGET_DIR=$(pwd)/target
cargo miri test --manifest-path "$MIRI_LIB_SRC/$CRATE/Cargo.toml" "$@"
if [[ -z "${USE_NEXTEST:-}" ]]; then
cargo miri test --manifest-path "$MIRI_LIB_SRC/$CRATE/Cargo.toml" "$@"
else
cargo miri nextest run --manifest-path "$MIRI_LIB_SRC/$CRATE/Cargo.toml" "$@"
fi
Loading