rust/ci.sh

56 lines
1.5 KiB
Bash
Raw Normal View History

#!/bin/bash
2019-02-08 05:13:07 -06:00
set -euo pipefail
# Determine configuration
export RUST_TEST_NOCAPTURE=1
export RUST_BACKTRACE=1
export RUSTFLAGS="-D warnings"
export CARGO_INCREMENTAL=0
export CARGO_EXTRA_FLAGS="--all-features"
# 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
# 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-06-25 04:34:52 -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-06-25 04:34:52 -05: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 17:17:18 -05:00
# "miri test" has built the sysroot for us, now this should pass without
# any interactive questions.
2020-05-11 03:40:25 -05:00
${PYTHON:-python3} test-cargo-miri/run-test.py
2020-03-21 17:17:18 -05:00
echo
}
2020-03-21 17:17:18 -05:00
# host
run_tests
if [ "${TRAVIS_OS_NAME:-}" == linux ]; then
MIRI_TEST_TARGET=i686-unknown-linux-gnu run_tests
2020-03-21 17:28:10 -05:00
MIRI_TEST_TARGET=x86_64-apple-darwin run_tests
MIRI_TEST_TARGET=i686-pc-windows-msvc run_tests
elif [ "${TRAVIS_OS_NAME:-}" == osx ]; then
2020-05-14 12:21:04 -05:00
MIRI_TEST_TARGET=i686-unknown-linux-gnu run_tests
2020-03-21 17:28:10 -05:00
MIRI_TEST_TARGET=x86_64-pc-windows-msvc run_tests
MIRI_TEST_TARGET=i686-pc-windows-gnu run_tests
elif [ "${CI_WINDOWS:-}" == True ]; then
MIRI_TEST_TARGET=x86_64-unknown-linux-gnu run_tests
MIRI_TEST_TARGET=x86_64-apple-darwin run_tests
else
echo "FATAL: unknown CI platform"
exit 1
2020-01-06 03:43:41 -06:00
fi