Extract travis testing into locally-runnable script

This commit is contained in:
Carl Dong 2019-01-24 11:37:55 -05:00
parent 51971dd533
commit 50fef2d851
2 changed files with 44 additions and 16 deletions

View File

@ -1,22 +1,16 @@
language: rust
rust:
- stable
- beta
- nightly
- 1.22.0
before_install:
- sudo apt-get -qq update
- sudo apt-get install -y binutils-dev libunwind8-dev
matrix:
include:
- rust: stable
env: DO_FUZZ=true
- rust: beta
- rust: nightly
env: DO_BENCH=true
- rust: 1.22.0
script:
- cargo build --verbose
- cargo test --verbose
- cargo build --verbose --features=bitcoinconsensus
- cargo test --verbose --features=bitcoinconsensus
- cargo build --verbose --features=use-serde
- cargo test --verbose --features=use-serde
- cargo build --verbose --features=serde-decimal
- cargo test --verbose --features=serde-decimal
- if [ "$(rustup show | grep default | grep stable)" != "" ]; then cd fuzz && cargo test --verbose && ./travis-fuzz.sh; fi
- if [ "$(rustup show | grep default | grep nightly)" != "" ]; then cargo bench --features unstable; fi
- ./contrib/test.sh

34
contrib/test.sh Executable file
View File

@ -0,0 +1,34 @@
#!/bin/sh -ex
FEATURES="bitcoinconsensus use-serde serde-decimal"
# Use toolchain if explicitly specified
if [ -n "$TOOLCHAIN" ]
then
alias cargo="cargo +$TOOLCHAIN"
fi
# Test without any features first
cargo test --verbose
# Test each feature
for feature in ${FEATURES}
do
cargo test --verbose --features="$feature"
done
# Fuzz if told to
if [ "$DO_FUZZ" = true ]
then
(
cd fuzz
cargo test --verbose
./travis-fuzz.sh
)
fi
# Bench if told to
if [ "$DO_BENCH" = true ]
then
cargo bench --features unstable
fi