Skip to content

Commit

Permalink
Auto merge of rust-lang#3189 - RalfJung:ci, r=RalfJung
Browse files Browse the repository at this point in the history
run the provenance-gc=1 test on all targets, but only for the host tests

No need to slow down *all those tests* running on the Linux host... but lets cover each major OS at least once. We've had bugs that only some macOS-specific code in `getrandom` found, after all.

Let's see how much this affects timing on the macOS / Windows runners.
  • Loading branch information
bors committed Nov 25, 2023
2 parents 2132d78 + 695f1a5 commit 535db18
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
4 changes: 0 additions & 4 deletions src/tools/miri/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set the tag GC interval to 1 on linux
if: runner.os == 'Linux'
run: echo "MIRIFLAGS=-Zmiri-provenance-gc=1" >> $GITHUB_ENV

# Cache the global cargo directory, but NOT the local `target` directory which
# we cannot reuse anyway when the nightly changes (and it grows quite large
# over time).
Expand Down
27 changes: 20 additions & 7 deletions src/tools/miri/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,23 @@ endgroup

# Test
function run_tests {
if [ -n "${MIRI_TEST_TARGET+exists}" ]; then
if [ -n "${MIRI_TEST_TARGET:-}" ]; then
begingroup "Testing foreign architecture $MIRI_TEST_TARGET"
else
begingroup "Testing host architecture"
fi

## ui test suite
./miri test
if [ -z "${MIRI_TEST_TARGET+exists}" ]; then
# Host-only tests: running these on all targets is unlikely to catch more problems and would
# On the host and on Linux, also stress-test the GC.
if [ -z "${MIRI_TEST_TARGET:-}" ] || [ "$HOST_TARGET" = x86_64-unknown-linux-gnu ]; then
MIRIFLAGS="${MIRIFLAGS:-} -Zmiri-provenance-gc=1" ./miri test
else
./miri test
fi

# Host-only tests
if [ -z "${MIRI_TEST_TARGET:-}" ]; then
# Running these on all targets is unlikely to catch more problems and would
# cost a lot of CI time.

# Tests with optimizations (`-O` is what cargo passes, but crank MIR optimizations up all the
Expand Down Expand Up @@ -85,10 +92,11 @@ function run_tests {
}

function run_tests_minimal {
if [ -n "${MIRI_TEST_TARGET+exists}" ]; then
if [ -n "${MIRI_TEST_TARGET:-}" ]; then
begingroup "Testing MINIMAL foreign architecture $MIRI_TEST_TARGET: only testing $@"
else
begingroup "Testing MINIMAL host architecture: only testing $@"
echo "run_tests_minimal requires MIRI_TEST_TARGET to be set"
exit 1
fi

./miri test -- "$@"
Expand All @@ -99,15 +107,20 @@ function run_tests_minimal {
endgroup
}

# host
## Main Testing Logic ##

# Host target.
run_tests

# Extra targets.
# In particular, fully cover all tier 1 targets.
case $HOST_TARGET in
x86_64-unknown-linux-gnu)
MIRI_TEST_TARGET=i686-unknown-linux-gnu run_tests
MIRI_TEST_TARGET=aarch64-unknown-linux-gnu run_tests
MIRI_TEST_TARGET=aarch64-apple-darwin run_tests
MIRI_TEST_TARGET=i686-pc-windows-gnu run_tests
# Some targets are only partially supported.
MIRI_TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal hello integer vec panic/panic concurrency/simple pthread-threadname libc-getentropy libc-getrandom libc-misc libc-fs atomic env align
MIRI_TEST_TARGET=i686-unknown-freebsd run_tests_minimal hello integer vec panic/panic concurrency/simple pthread-threadname libc-getentropy libc-getrandom libc-misc libc-fs atomic env align
MIRI_TEST_TARGET=aarch64-linux-android run_tests_minimal hello integer vec panic/panic
Expand Down

0 comments on commit 535db18

Please sign in to comment.