Merge pull request #227 from dongcarl/2019-01-improve-local-testing

Extract travis testing into locally-runnable script
This commit is contained in:
Carl Dong 2019-02-11 16:24:05 -05:00 committed by GitHub
commit f87e173268
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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