rust/travis.sh

42 lines
1009 B
Bash
Raw Normal View History

#!/bin/bash
2019-02-08 11:13:07 +00:00
set -euo pipefail
# 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"
# 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
# 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
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
}
2020-03-21 22:17:18 +00:00
# host
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