]> git.lizzy.rs Git - rust.git/blobdiff - ci.sh
Explain `tests::init` function
[rust.git] / ci.sh
diff --git a/ci.sh b/ci.sh
index a86c5ca490a40fa06cad32df515f257a132ffdd9..e7c6ed833c60c4b60bed064f5128570375a5f70b 100755 (executable)
--- a/ci.sh
+++ b/ci.sh
@@ -1,15 +1,16 @@
 #!/bin/bash
 set -euo pipefail
+set -x
 
 # Determine configuration
 export RUSTFLAGS="-D warnings"
 export CARGO_INCREMENTAL=0
-export CARGO_EXTRA_FLAGS="--all-features"
+export CARGO_EXTRA_FLAGS="--all-features" # in particular, expensive-debug-assertions
 
 # Prepare
 echo "Build and install miri"
-./miri build --all-targets --locked
-./miri install # implicitly locked
+CARGO_EXTRA_FLAGS="" ./miri install # implicitly locked -- and the *installed* Miri does *not* get the expensive-debug-assertions feature
+./miri build --all-targets --locked # the build that all the `./miri test` below will use
 echo
 
 # Test
@@ -24,7 +25,9 @@ function run_tests {
   if [ -z "${MIRI_TEST_TARGET+exists}" ]; then
     # Only for host architecture: tests with optimizations (`-O` is what cargo passes, but crank MIR
     # optimizations up all the way).
-    MIRIFLAGS="-O -Zmir-opt-level=4" ./miri test --locked
+    # Optimizations change diagnostics (mostly backtraces), so we don't check them
+    #FIXME(#2155): we want to only run the pass and panic tests here, not the fail tests.
+    MIRIFLAGS="-O -Zmir-opt-level=4" MIRI_SKIP_UI_CHECKS=1 ./miri test --locked -- tests/{pass,panic}
   fi
 
   # On Windows, there is always "python", not "python3" or "python2".
@@ -38,6 +41,23 @@ function run_tests {
   # any interactive questions.
   ${PYTHON} test-cargo-miri/run-test.py
   echo
+
+  # Ensure that our benchmarks all work, on the host at least.
+  if [ -z "${MIRI_TEST_TARGET+exists}" ]; then
+    for BENCH in $(ls "bench-cargo-miri"); do
+      cargo miri run --manifest-path bench-cargo-miri/$BENCH/Cargo.toml
+    done
+  fi
+}
+
+function run_tests_minimal {
+  if [ -n "${MIRI_TEST_TARGET+exists}" ]; then
+    echo "Testing MINIMAL foreign architecture $MIRI_TEST_TARGET: only testing $@"
+  else
+    echo "Testing MINIMAL host architecture: only testing $@"
+  fi
+
+  ./miri test --locked -- "$@"
 }
 
 # host
@@ -48,6 +68,8 @@ case $HOST_TARGET in
     MIRI_TEST_TARGET=i686-unknown-linux-gnu run_tests
     MIRI_TEST_TARGET=aarch64-apple-darwin run_tests
     MIRI_TEST_TARGET=i686-pc-windows-msvc run_tests
+    MIRI_TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal hello integer vec current_dir data_race env
+    MIRI_TEST_TARGET=thumbv7em-none-eabihf MIRI_NO_STD=1 run_tests_minimal no_std # no_std embedded architecture
     ;;
   x86_64-apple-darwin)
     MIRI_TEST_TARGET=mips64-unknown-linux-gnuabi64 run_tests # big-endian architecture
@@ -55,7 +77,6 @@ case $HOST_TARGET in
     ;;
   i686-pc-windows-msvc)
     MIRI_TEST_TARGET=x86_64-unknown-linux-gnu run_tests
-    MIRI_TEST_TARGET=x86_64-apple-darwin run_tests
     ;;
   *)
     echo "FATAL: unknown OS"