2019-01-24 16:37:55 +00:00
|
|
|
#!/bin/sh -ex
|
|
|
|
|
2019-03-26 16:05:51 +00:00
|
|
|
FEATURES="bitcoinconsensus use-serde"
|
2019-01-24 16:37:55 +00:00
|
|
|
|
2019-07-26 19:23:02 +00:00
|
|
|
if [ "$DO_COV" = true ]
|
|
|
|
then
|
|
|
|
export RUSTFLAGS="-C link-dead-code"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2019-01-24 16:37:55 +00:00
|
|
|
# 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
|
2019-08-18 16:26:52 +00:00
|
|
|
|
|
|
|
# Use as dependency if told to
|
|
|
|
if [ -n "$AS_DEPENDENCY" ]
|
|
|
|
then
|
|
|
|
cargo new dep_test
|
|
|
|
cd dep_test
|
|
|
|
echo 'bitcoin = { path = "..", features = ["use-serde"] }' >> Cargo.toml
|
|
|
|
cargo test --verbose
|
|
|
|
fi
|