From 2a89b74bc75d1b30f5e71091cc66fc9f5789d69a Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 25 Nov 2023 10:11:05 +0100 Subject: [PATCH 1/2] run the provenance-gc=1 test on all targets, but only for some of the tests before: only on Linux host, all tests after: only the test suite itself (not cargo-miri or the mir-opt-level=4 run), on all hosts for the host target and on Linux for all "full" targets. --- src/tools/miri/.github/workflows/ci.yml | 4 ---- src/tools/miri/ci.sh | 17 ++++++++++++----- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/tools/miri/.github/workflows/ci.yml b/src/tools/miri/.github/workflows/ci.yml index 554a12909fc..dec85e9232f 100644 --- a/src/tools/miri/.github/workflows/ci.yml +++ b/src/tools/miri/.github/workflows/ci.yml @@ -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). diff --git a/src/tools/miri/ci.sh b/src/tools/miri/ci.sh index 378d7744cf2..0492953671e 100755 --- a/src/tools/miri/ci.sh +++ b/src/tools/miri/ci.sh @@ -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 @@ -85,7 +92,7 @@ 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 $@" From 695f1a515e532e079545982b63906233879959f4 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 25 Nov 2023 13:09:35 +0100 Subject: [PATCH 2/2] tweak ci.sh --- src/tools/miri/ci.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/tools/miri/ci.sh b/src/tools/miri/ci.sh index 0492953671e..34892489c80 100755 --- a/src/tools/miri/ci.sh +++ b/src/tools/miri/ci.sh @@ -95,7 +95,8 @@ function run_tests_minimal { 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 -- "$@" @@ -106,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=aarch64-linux-android run_tests_minimal hello integer vec panic/panic MIRI_TEST_TARGET=wasm32-wasi run_tests_minimal no_std integer strings wasm