Skip to content

Commit 3b37e77

Browse files
committed
Only enable selected features when testing miri in CI
1 parent 201c5c7 commit 3b37e77

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ harness = false
6565

6666
[features]
6767
default = ["stack-cache"]
68+
# when adding a new feature that is relevant for some tests,
69+
# make sure to add it to the FEATURES variable in `ci/ci.sh`
6870
genmc = []
6971
stack-cache = []
7072
stack-cache-consistency-check = ["stack-cache"]

ci/ci.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ begingroup "Building Miri"
2828
export RUSTFLAGS="-D warnings"
2929
export CARGO_INCREMENTAL=0
3030
export CARGO_EXTRA_FLAGS="--locked"
31+
# We enable all features (except tracing) to make sure the Stacked Borrows consistency check runs.
32+
export FEATURES="--features=genmc,stack-cache,stack-cache-consistency-check"
3133

3234
# Determine configuration for installed build (used by test-cargo-miri and `./miri bench`).
3335
echo "Installing release version of Miri"
34-
time ./miri install
36+
time ./miri install "$FEATURES"
3537

3638
# Prepare debug build for direct `./miri` invocations.
37-
# We enable all features to make sure the Stacked Borrows consistency check runs.
3839
echo "Building debug version of Miri"
39-
export CARGO_EXTRA_FLAGS="$CARGO_EXTRA_FLAGS --all-features"
40-
time ./miri build # the build that all the `./miri test` below will use
40+
time ./miri build "$FEATURES" # the build that all the `./miri test` below will use
4141

4242
endgroup
4343

@@ -61,9 +61,9 @@ function run_tests {
6161

6262
## ui test suite
6363
if [ -n "${GC_STRESS-}" ]; then
64-
time MIRIFLAGS="${MIRIFLAGS-} -Zmiri-provenance-gc=1" ./miri test $TARGET_FLAG
64+
time MIRIFLAGS="${MIRIFLAGS-} -Zmiri-provenance-gc=1" ./miri test "$FEATURES" $TARGET_FLAG
6565
else
66-
time ./miri test $TARGET_FLAG
66+
time ./miri test "$FEATURES" $TARGET_FLAG
6767
fi
6868

6969
## advanced tests
@@ -74,20 +74,20 @@ function run_tests {
7474
# them. Also error locations change so we don't run the failing tests.
7575
# We explicitly enable debug-assertions here, they are disabled by -O but we have tests
7676
# which exist to check that we panic on debug assertion failures.
77-
time MIRIFLAGS="${MIRIFLAGS-} -O -Zmir-opt-level=4 -Cdebug-assertions=yes" MIRI_SKIP_UI_CHECKS=1 ./miri test $TARGET_FLAG tests/{pass,panic}
77+
time MIRIFLAGS="${MIRIFLAGS-} -O -Zmir-opt-level=4 -Cdebug-assertions=yes" MIRI_SKIP_UI_CHECKS=1 ./miri test "$FEATURES" $TARGET_FLAG tests/{pass,panic}
7878
fi
7979
if [ -n "${MANY_SEEDS-}" ]; then
8080
# Run many-seeds tests. (Also tests `./miri run`.)
8181
time for FILE in tests/many-seeds/*.rs; do
82-
./miri run "-Zmiri-many-seeds=0..$MANY_SEEDS" $TARGET_FLAG "$FILE"
82+
./miri run "$FEATURES" $TARGET_FLAG "-Zmiri-many-seeds=0..$MANY_SEEDS" "$FILE"
8383
done
8484
fi
8585
if [ -n "${TEST_BENCH-}" ]; then
8686
# Check that the benchmarks build and run, but only once.
8787
time HYPERFINE="hyperfine -w0 -r1 --show-output" ./miri bench $TARGET_FLAG --no-install
8888
fi
8989
# Smoke-test `./miri run --dep`.
90-
./miri run $TARGET_FLAG --dep tests/pass-dep/getrandom.rs
90+
./miri run "$FEATURES" $TARGET_FLAG --dep tests/pass-dep/getrandom.rs
9191

9292
## test-cargo-miri
9393
# On Windows, there is always "python", not "python3" or "python2".
@@ -125,7 +125,7 @@ function run_tests_minimal {
125125
exit 1
126126
fi
127127

128-
time ./miri test $TARGET_FLAG "$@"
128+
time ./miri test "$FEATURES" $TARGET_FLAG "$@"
129129

130130
# Ensure that a small smoke test of cargo-miri works.
131131
time cargo miri run --manifest-path test-cargo-miri/no-std-smoke/Cargo.toml $TARGET_FLAG

0 commit comments

Comments
 (0)