2018-12-12 19:15:57 +01:00
|
|
|
#!/bin/bash
|
2019-02-08 12:13:07 +01:00
|
|
|
set -euo pipefail
|
2018-12-12 19:15:57 +01:00
|
|
|
|
|
|
|
# Determine configuration
|
2020-05-10 23:49:10 +02:00
|
|
|
export RUST_TEST_NOCAPTURE=1
|
|
|
|
export RUST_BACKTRACE=1
|
2020-05-21 11:23:04 +02:00
|
|
|
export RUSTFLAGS="-D warnings"
|
2020-05-10 23:49:10 +02:00
|
|
|
export CARGO_INCREMENTAL=0
|
|
|
|
export CARGO_EXTRA_FLAGS="--all-features"
|
2018-12-12 19:15:57 +01:00
|
|
|
|
2019-04-21 22:35:47 +02:00
|
|
|
# Prepare
|
2018-12-12 19:52:49 +01:00
|
|
|
echo "Build and install miri"
|
2019-10-14 09:40:11 +02:00
|
|
|
./miri build --all-targets --locked
|
|
|
|
./miri install # implicitly locked
|
2018-12-12 19:52:49 +01:00
|
|
|
echo
|
2018-12-12 19:15:57 +01:00
|
|
|
|
2019-04-21 22:35:47 +02:00
|
|
|
# Test
|
|
|
|
function run_tests {
|
2020-03-21 23:28:10 +01:00
|
|
|
if [ -n "${MIRI_TEST_TARGET+exists}" ]; then
|
|
|
|
echo "Testing foreign architecture $MIRI_TEST_TARGET"
|
2020-03-21 23:17:18 +01:00
|
|
|
else
|
|
|
|
echo "Testing host architecture"
|
|
|
|
fi
|
|
|
|
|
|
|
|
./miri test --locked
|
2020-06-25 11:34:52 +02:00
|
|
|
if ! [ -n "${MIRI_TEST_TARGET+exists}" ]; then
|
2020-03-21 23:17:18 +01:00
|
|
|
# Only for host architecture: tests with MIR optimizations
|
2020-06-25 11:34:52 +02:00
|
|
|
# FIXME:only testing level 1 because of <https://github.com/rust-lang/rust/issues/73223>.
|
|
|
|
MIRI_TEST_FLAGS="-Z mir-opt-level=1" ./miri test --locked
|
|
|
|
fi
|
2020-03-21 23:17:18 +01:00
|
|
|
# "miri test" has built the sysroot for us, now this should pass without
|
|
|
|
# any interactive questions.
|
2020-05-11 10:40:25 +02:00
|
|
|
${PYTHON:-python3} test-cargo-miri/run-test.py
|
2020-03-21 23:17:18 +01:00
|
|
|
|
|
|
|
echo
|
2019-04-21 22:35:47 +02:00
|
|
|
}
|
|
|
|
|
2020-03-21 23:17:18 +01:00
|
|
|
# host
|
2019-04-21 22:35:47 +02:00
|
|
|
run_tests
|
2020-03-21 23:26:44 +01:00
|
|
|
|
2020-05-10 23:49:10 +02:00
|
|
|
if [ "${TRAVIS_OS_NAME:-}" == linux ]; then
|
|
|
|
MIRI_TEST_TARGET=i686-unknown-linux-gnu run_tests
|
2020-03-21 23:28:10 +01:00
|
|
|
MIRI_TEST_TARGET=x86_64-apple-darwin run_tests
|
|
|
|
MIRI_TEST_TARGET=i686-pc-windows-msvc run_tests
|
2020-05-10 23:49:10 +02:00
|
|
|
elif [ "${TRAVIS_OS_NAME:-}" == osx ]; then
|
2020-05-14 19:21:04 +02:00
|
|
|
MIRI_TEST_TARGET=i686-unknown-linux-gnu run_tests
|
2020-03-21 23:28:10 +01:00
|
|
|
MIRI_TEST_TARGET=x86_64-pc-windows-msvc run_tests
|
2020-03-25 11:44:11 +01:00
|
|
|
MIRI_TEST_TARGET=i686-pc-windows-gnu run_tests
|
2020-05-10 23:49:10 +02:00
|
|
|
elif [ "${CI_WINDOWS:-}" == True ]; then
|
|
|
|
MIRI_TEST_TARGET=x86_64-unknown-linux-gnu run_tests
|
|
|
|
MIRI_TEST_TARGET=x86_64-apple-darwin run_tests
|
2020-05-21 11:30:37 +02:00
|
|
|
else
|
|
|
|
echo "FATAL: unknown CI platform"
|
|
|
|
exit 1
|
2020-01-06 10:43:41 +01:00
|
|
|
fi
|