5 # Determine configuration
6 export RUSTFLAGS="-D warnings"
7 export CARGO_INCREMENTAL=0
8 export CARGO_EXTRA_FLAGS="--all-features"
11 echo "Build and install miri"
12 ./miri install # implicitly locked
13 ./miri build --all-targets --locked # the build that all the `./miri test` below will use
18 if [ -n "${MIRI_TEST_TARGET+exists}" ]; then
19 echo "Testing foreign architecture $MIRI_TEST_TARGET"
21 echo "Testing host architecture"
26 if [ -z "${MIRI_TEST_TARGET+exists}" ]; then
27 # Only for host architecture: tests with optimizations (`-O` is what cargo passes, but crank MIR
28 # optimizations up all the way).
29 # Optimizations change diagnostics (mostly backtraces), so we don't check them
30 #FIXME(#2155): we want to only run the pass and panic tests here, not the fail tests.
31 MIRIFLAGS="-O -Zmir-opt-level=4" MIRI_SKIP_UI_CHECKS=1 ./miri test --locked -- tests/{pass,panic}
35 # On Windows, there is always "python", not "python3" or "python2".
36 if command -v python3 > /dev/null; then
41 # Some environment setup that attempts to confuse the heck out of cargo-miri.
42 if [ "$HOST_TARGET" = x86_64-unknown-linux-gnu ]; then
43 # These act up on Windows (`which miri` produces a filename that does not exist?!?),
44 # so let's do this only on Linux. Also makes sure things work without these set.
45 export RUSTC=$(which rustc)
46 export MIRI=$(which miri)
49 echo 'build.rustc-wrapper = "thisdoesnotexist"' > .cargo/config.toml
51 ${PYTHON} test-cargo-miri/run-test.py
57 # Ensure that our benchmarks all work, on the host at least.
58 if [ -z "${MIRI_TEST_TARGET+exists}" ]; then
59 for BENCH in $(ls "bench-cargo-miri"); do
60 cargo miri run --manifest-path bench-cargo-miri/$BENCH/Cargo.toml
65 function run_tests_minimal {
66 if [ -n "${MIRI_TEST_TARGET+exists}" ]; then
67 echo "Testing MINIMAL foreign architecture $MIRI_TEST_TARGET: only testing $@"
69 echo "Testing MINIMAL host architecture: only testing $@"
72 ./miri test --locked -- "$@"
79 x86_64-unknown-linux-gnu)
80 MIRI_TEST_TARGET=i686-unknown-linux-gnu run_tests
81 MIRI_TEST_TARGET=aarch64-apple-darwin run_tests
82 MIRI_TEST_TARGET=i686-pc-windows-msvc run_tests
83 MIRI_TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal hello integer vec current_dir data_race env
84 MIRI_TEST_TARGET=thumbv7em-none-eabihf MIRI_NO_STD=1 run_tests_minimal no_std # no_std embedded architecture
87 MIRI_TEST_TARGET=mips64-unknown-linux-gnuabi64 run_tests # big-endian architecture
88 MIRI_TEST_TARGET=x86_64-pc-windows-msvc run_tests
91 MIRI_TEST_TARGET=x86_64-unknown-linux-gnu run_tests
94 echo "FATAL: unknown OS"