2018-12-12 18:15:57 +00:00
|
|
|
#!/bin/bash
|
2019-02-08 11:13:07 +00:00
|
|
|
set -euo pipefail
|
2018-12-12 18:15:57 +00:00
|
|
|
|
|
|
|
# Determine configuration
|
2019-05-28 17:02:54 +00:00
|
|
|
export CARGO_EXTRA_FLAGS="--all-features"
|
2019-08-15 09:14:45 +00:00
|
|
|
export RUSTC_EXTRA_FLAGS="-D warnings"
|
2018-12-12 18:15:57 +00:00
|
|
|
|
2019-04-21 20:35:47 +00:00
|
|
|
# Prepare
|
2018-12-12 18:52:49 +00:00
|
|
|
echo "Build and install miri"
|
2019-10-14 07:40:11 +00:00
|
|
|
./miri build --all-targets --locked
|
|
|
|
./miri install # implicitly locked
|
2018-12-12 18:52:49 +00:00
|
|
|
echo
|
2018-12-12 18:15:57 +00:00
|
|
|
|
2019-04-21 20:35:47 +00:00
|
|
|
# Test
|
|
|
|
function run_tests {
|
2020-03-21 22:17:18 +00:00
|
|
|
if [ -n "${FOREIGN_TARGET+exists}" ]; then
|
|
|
|
echo "Testing foreign architecture $FOREIGN_TARGET"
|
|
|
|
else
|
|
|
|
echo "Testing host architecture"
|
|
|
|
fi
|
|
|
|
|
|
|
|
./miri test --locked
|
|
|
|
if ! [ -n "${FOREIGN_TARGET+exists}" ]; then
|
|
|
|
# Only for host architecture: tests with MIR optimizations
|
2020-03-18 10:19:01 +00:00
|
|
|
MIRI_TEST_FLAGS="-Z mir-opt-level=3" ./miri test
|
2020-03-21 22:17:18 +00: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 20:35:47 +00:00
|
|
|
}
|
|
|
|
|
2020-03-21 22:17:18 +00:00
|
|
|
# host
|
2019-04-21 20:35:47 +00:00
|
|
|
run_tests
|
2020-03-21 22:17:18 +00:00
|
|
|
# cross-test 32bit Linux from everywhere
|
|
|
|
MIRI_TEST_TARGET=i686-unknown-linux-gnu run_tests
|
|
|
|
if [ "$TRAVIS_OS_NAME" == linux ]; then
|
|
|
|
# cross-test 64bit macOS from Linux
|
|
|
|
FOREIGN_TARGET=x86_64-apple-darwin run_tests
|
2020-01-06 09:43:41 +00:00
|
|
|
fi
|