From b72f1d70e5bf0f4b4238eeab7628263941da1b9a Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Wed, 6 Dec 2023 10:03:13 +1100 Subject: [PATCH] bitcoin: Add DO_FEATURE_MATRIX Add a feature matrix section to the `bitcoin` CI script as we do in `hashes`. This means: - test with no default features - test with all individual features - test with all combinations of two features Note, with this applied all features and optional dependencies are included in `FEATURES` (excluding `secp-lowmemory`). The feature matrix test gets run for stable and MSRV toolchains. --- bitcoin/contrib/test.sh | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/bitcoin/contrib/test.sh b/bitcoin/contrib/test.sh index 689a94da..45b5b79f 100755 --- a/bitcoin/contrib/test.sh +++ b/bitcoin/contrib/test.sh @@ -2,7 +2,7 @@ set -ex -FEATURES="base64 bitcoinconsensus serde rand secp-recovery" +FEATURES="std rand-std rand serde secp-recovery bitcoinconsensus-std base64 bitcoinconsensus" if [ "$DO_COV" = true ] then @@ -23,6 +23,13 @@ if cargo --version | grep beta; then STABLE=false fi +# Make all cargo invocations verbose +export CARGO_TERM_VERBOSE=true + +# Defaults / sanity checks +cargo build +cargo test + if [ "$DO_LINT" = true ] then cargo clippy --locked --all-features --all-targets -- -D warnings @@ -53,20 +60,25 @@ then fi fi -echo "********* Testing std *************" -# Test without any features other than std first -cargo test --locked --verbose --no-default-features --features="std" +if [ "$DO_FEATURE_MATRIX" = true ]; then + cargo build --locked --no-default-features + cargo test --locked --no-default-features -echo "********* Testing default *************" -# Then test with the default features -cargo test --verbose - -# Test each feature -for feature in ${FEATURES} -do - echo "********* Testing $feature *************" - cargo test --locked --verbose --features="$feature" -done + # All features + cargo build --locked --no-default-features --features="$FEATURES" + cargo test --locked --no-default-features --features="$FEATURES" + # Single features + for feature in ${FEATURES} + do + cargo build --locked --no-default-features --features="$feature" + cargo test --locked --no-default-features --features="$feature" + # All combos of two features + for featuretwo in ${FEATURES}; do + cargo build --locked --no-default-features --features="$feature $featuretwo" + cargo test --locked --no-default-features --features="$feature $featuretwo" + done + done +fi cargo run --locked --example bip32 7934c09359b234e076b9fa5a1abfd38e3dc2a9939745b7cc3c22a48d831d14bd cargo run --locked --no-default-features --example bip32 7934c09359b234e076b9fa5a1abfd38e3dc2a9939745b7cc3c22a48d831d14bd