Skip to content

Commit 889ac1b

Browse files
authored
[ci] Run Miri tests on multiple threads (#1307)
Use `cargo nextest` to run Miri tests on twice the number of threads as there are CPU cores.
1 parent c579298 commit 889ac1b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,23 @@ jobs:
244244
245245
- name: Run tests under Miri
246246
run: |
247+
set -eo pipefail
248+
247249
# Work around https://github.com/rust-lang/miri/issues/3125
248250
[ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ] && cargo clean
249-
251+
252+
# Spawn twice the number of workers as there are CPU cores.
253+
THREADS=$(echo "$(nproc) * 2" | bc)
254+
echo "Running Miri tests with $THREADS threads" | tee -a $GITHUB_STEP_SUMMARY
255+
256+
cargo install cargo-nextest
257+
250258
# Run under both the stacked borrows model (default) and under the tree
251259
# borrows model to ensure we're compliant with both.
252260
for EXTRA_FLAGS in "" "-Zmiri-tree-borrows"; do
253261
MIRIFLAGS="$MIRIFLAGS $EXTRA_FLAGS" ./cargo.sh +${{ matrix.toolchain }} \
254-
miri test \
262+
miri nextest run \
263+
--test-threads "$THREADS" \
255264
--package ${{ matrix.crate }} \
256265
--target ${{ matrix.target }} \
257266
${{ matrix.features }}
@@ -464,6 +473,7 @@ jobs:
464473
cargo metadata &> /dev/null &
465474
cargo install cargo-readme --version 3.2.0 &> /dev/null &
466475
cargo install --locked kani-verifier &> /dev/null &
476+
cargo install cargo-nextest &> /dev/null &
467477
cargo kani setup &> /dev/null &
468478
469479
wait

0 commit comments

Comments
 (0)