]> git.lizzy.rs Git - rust.git/blob - ci.sh
Small changes.
[rust.git] / ci.sh
1 #!/bin/bash
2 set -euo pipefail
3
4 # Determine configuration
5 export RUST_TEST_NOCAPTURE=1
6 export RUST_BACKTRACE=1
7 export RUSTC_EXTRA_FLAGS="-D warnings"
8 export CARGO_INCREMENTAL=0
9 export CARGO_EXTRA_FLAGS="--all-features"
10
11 # Prepare
12 echo "Build and install miri"
13 ./miri build --all-targets --locked
14 ./miri install # implicitly locked
15 echo
16
17 # Test
18 function run_tests {
19   if [ -n "${MIRI_TEST_TARGET+exists}" ]; then
20     echo "Testing foreign architecture $MIRI_TEST_TARGET"
21   else
22     echo "Testing host architecture"
23   fi
24
25   ./miri test --locked
26   if ! [ -n "${MIRI_TEST_TARGET+exists}" ]; then
27     # Only for host architecture: tests with MIR optimizations
28     MIRI_TEST_FLAGS="-Z mir-opt-level=3" ./miri test --locked
29   fi
30   # "miri test" has built the sysroot for us, now this should pass without
31   # any interactive questions.
32   ${PYTHON:-python3} test-cargo-miri/run-test.py
33
34   echo
35 }
36
37 # host
38 run_tests
39
40 if [ "${TRAVIS_OS_NAME:-}" == linux ]; then
41   MIRI_TEST_TARGET=i686-unknown-linux-gnu run_tests
42   MIRI_TEST_TARGET=x86_64-apple-darwin run_tests
43   MIRI_TEST_TARGET=i686-pc-windows-msvc run_tests
44 elif [ "${TRAVIS_OS_NAME:-}" == osx ]; then
45   MIRI_TEST_TARGET=i686-unknown-linux-gnu run_tests
46   MIRI_TEST_TARGET=x86_64-pc-windows-msvc run_tests
47   MIRI_TEST_TARGET=i686-pc-windows-gnu run_tests
48 elif [ "${CI_WINDOWS:-}" == True ]; then
49   MIRI_TEST_TARGET=x86_64-unknown-linux-gnu run_tests
50   MIRI_TEST_TARGET=x86_64-apple-darwin run_tests
51 fi