Merge pull request #16 from thomcc/miri

Run miri in CI
This commit is contained in:
Lokathor 2020-01-10 20:49:02 -07:00 committed by GitHub
commit 481c6879ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 63 additions and 39 deletions

View File

@ -48,6 +48,8 @@ matrix:
- { os: osx, rust: 1.34.0, env: TARGET=i386-apple-ios } - { os: osx, rust: 1.34.0, env: TARGET=i386-apple-ios }
- { os: osx, rust: 1.34.0, env: TARGET=x86_64-apple-ios } - { os: osx, rust: 1.34.0, env: TARGET=x86_64-apple-ios }
- { os: linux, rust: nightly, env: RUN_MIRI=1 }
script: script:
- pushd scripts - pushd scripts
- ./travis.sh - ./travis.sh

View File

@ -2,54 +2,76 @@
set -e set -e
rustup component add clippy if [[ "$RUN_MIRI" != "" ]]; then
cargo clippy
if [[ "$TARGET" != "" ]]; then rustup target install $TARGET; fi cargo clean
if [[ "$TARGET" == "wasm32-"* && "$TARGET" != "wasm32-wasi" ]]; then # Install and run the latest version of nightly where miri built successfully.
cargo-web --version || cargo install cargo-web # Taken from: https://github.com/rust-lang/miri#running-miri-on-ci
cargo web test --no-default-features $FLAGS --target=$TARGET
cargo web test $FLAGS --target=$TARGET
#cargo web test --all-features $FLAGS --target=$TARGET
elif [[ "$TARGET" == *"-linux-android"* ]]; then MIRI_NIGHTLY=nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/miri)
export PATH=/usr/local/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH echo "Installing latest nightly with Miri: $MIRI_NIGHTLY"
pushd linux-android rustup set profile minimal
cargo build --no-default-features --target=$TARGET $FLAGS rustup default "$MIRI_NIGHTLY"
cargo build --target=$TARGET $FLAGS
#cargo build --all-features --target=$TARGET $FLAGS
# Don't test, can't run android emulators successfully on travis currently
popd
elif [[ "$TARGET" == *"-apple-ios" || "$TARGET" == "wasm32-wasi" ]]; then rustup component add miri
cargo build --no-default-features --target=$TARGET $FLAGS cargo miri setup
cargo build --target=$TARGET $FLAGS
#cargo build --all-features --target=$TARGET $FLAGS
# Don't test
# iOS simulator setup/teardown is complicated
# cargo-web doesn't support wasm32-wasi yet, nor can wasm-pack test specify a target
elif [[ "$TARGET" == *"-unknown-linux-gnueabihf" ]]; then cargo miri test --verbose
#sudo apt-get update cargo miri test --verbose --no-default-features
#sudo apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf cargo miri test --verbose --all-features
pushd generic-cross
else
rustup component add clippy
cargo clippy
if [[ "$TARGET" != "" ]]; then rustup target install $TARGET; fi
if [[ "$TARGET" == "wasm32-"* && "$TARGET" != "wasm32-wasi" ]]; then
cargo-web --version || cargo install cargo-web
cargo web test --no-default-features $FLAGS --target=$TARGET
cargo web test $FLAGS --target=$TARGET
#cargo web test --all-features $FLAGS --target=$TARGET
elif [[ "$TARGET" == *"-linux-android"* ]]; then
export PATH=/usr/local/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
pushd linux-android
cargo build --no-default-features --target=$TARGET $FLAGS
cargo build --target=$TARGET $FLAGS
#cargo build --all-features --target=$TARGET $FLAGS
# Don't test, can't run android emulators successfully on travis currently
popd
elif [[ "$TARGET" == *"-apple-ios" || "$TARGET" == "wasm32-wasi" ]]; then
cargo build --no-default-features --target=$TARGET $FLAGS cargo build --no-default-features --target=$TARGET $FLAGS
cargo build --target=$TARGET $FLAGS cargo build --target=$TARGET $FLAGS
#cargo build --all-features --target=$TARGET $FLAGS #cargo build --all-features --target=$TARGET $FLAGS
# Don't test # Don't test
popd # iOS simulator setup/teardown is complicated
# cargo-web doesn't support wasm32-wasi yet, nor can wasm-pack test specify a target
elif [[ "$TARGET" != "" ]]; then elif [[ "$TARGET" == *"-unknown-linux-gnueabihf" ]]; then
pushd generic-cross #sudo apt-get update
cargo test --no-default-features --target=$TARGET $FLAGS #sudo apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
cargo test --target=$TARGET $FLAGS pushd generic-cross
#cargo test --all-features --target=$TARGET $FLAGS cargo build --no-default-features --target=$TARGET $FLAGS
popd cargo build --target=$TARGET $FLAGS
#cargo build --all-features --target=$TARGET $FLAGS
# Don't test
popd
elif [[ "$TARGET" != "" ]]; then
pushd generic-cross
cargo test --no-default-features --target=$TARGET $FLAGS
cargo test --target=$TARGET $FLAGS
#cargo test --all-features --target=$TARGET $FLAGS
popd
else
# Push nothing, target host CPU architecture
cargo test --no-default-features $FLAGS
cargo test $FLAGS
fi
else
# Push nothing, target host CPU architecture
cargo test --no-default-features $FLAGS
cargo test $FLAGS
#cargo test --all-features $FLAGS
fi fi