2018-12-12 12:15:57 -06:00
|
|
|
#!/bin/bash
|
2019-02-08 05:13:07 -06:00
|
|
|
set -euo pipefail
|
2018-12-12 12:15:57 -06:00
|
|
|
|
|
|
|
# Determine configuration
|
2019-05-28 12:02:54 -05:00
|
|
|
export CARGO_EXTRA_FLAGS="--all-features"
|
2019-08-15 04:14:45 -05:00
|
|
|
export RUSTC_EXTRA_FLAGS="-D warnings"
|
2018-12-12 12:15:57 -06:00
|
|
|
|
2019-04-21 15:35:47 -05:00
|
|
|
# Prepare
|
2018-12-12 12:52:49 -06:00
|
|
|
echo "Build and install miri"
|
2019-10-14 02:40:11 -05:00
|
|
|
./miri build --all-targets --locked
|
|
|
|
./miri install # implicitly locked
|
2018-12-12 12:52:49 -06:00
|
|
|
echo
|
2018-12-12 12:15:57 -06:00
|
|
|
|
2019-04-21 15:35:47 -05:00
|
|
|
# Test
|
|
|
|
function run_tests {
|
2020-03-21 17:28:10 -05:00
|
|
|
if [ -n "${MIRI_TEST_TARGET+exists}" ]; then
|
|
|
|
echo "Testing foreign architecture $MIRI_TEST_TARGET"
|
2020-03-21 17:17:18 -05:00
|
|
|
else
|
|
|
|
echo "Testing host architecture"
|
|
|
|
fi
|
|
|
|
|
|
|
|
./miri test --locked
|
2020-03-21 17:28:10 -05:00
|
|
|
if ! [ -n "${MIRI_TEST_TARGET+exists}" ]; then
|
2020-03-21 17:17:18 -05:00
|
|
|
# Only for host architecture: tests with MIR optimizations
|
2020-03-18 05:19:01 -05:00
|
|
|
MIRI_TEST_FLAGS="-Z mir-opt-level=3" ./miri test
|
2020-03-21 17:17:18 -05:00
|
|
|
fi
|
|
|
|
# "miri test" has built the sysroot for us, now this should pass without
|
|
|
|
# any interactive questions.
|
|
|
|
test-cargo-miri/run-test.py
|
|
|
|
|
|
|
|
echo
|
2019-04-21 15:35:47 -05:00
|
|
|
}
|
|
|
|
|
2020-03-21 17:17:18 -05:00
|
|
|
# host
|
2019-04-21 15:35:47 -05:00
|
|
|
run_tests
|
2020-03-21 17:17:18 -05:00
|
|
|
# cross-test 32bit Linux from everywhere
|
|
|
|
MIRI_TEST_TARGET=i686-unknown-linux-gnu run_tests
|
2020-03-21 17:26:44 -05:00
|
|
|
|
2020-03-21 17:17:18 -05:00
|
|
|
if [ "$TRAVIS_OS_NAME" == linux ]; then
|
|
|
|
# cross-test 64bit macOS from Linux
|
2020-03-21 17:28:10 -05:00
|
|
|
MIRI_TEST_TARGET=x86_64-apple-darwin run_tests
|
2020-03-21 17:26:44 -05:00
|
|
|
# cross-test 32bit Windows from Linux
|
2020-03-21 17:28:10 -05:00
|
|
|
MIRI_TEST_TARGET=i686-pc-windows-msvc run_tests
|
2020-03-21 17:26:44 -05:00
|
|
|
elif [ "$TRAVIS_OS_NAME" == osx ]; then
|
|
|
|
# cross-test 64bit Windows from macOS
|
2020-03-21 17:28:10 -05:00
|
|
|
MIRI_TEST_TARGET=x86_64-pc-windows-msvc run_tests
|
2020-03-25 05:44:11 -05:00
|
|
|
# cross-test 32bit GNU Windows from macOS
|
|
|
|
MIRI_TEST_TARGET=i686-pc-windows-gnu run_tests
|
2020-01-06 03:43:41 -06:00
|
|
|
fi
|