Skip to content

Commit 3913a08

Browse files
committed
Improve test coverage
In an effort to improve test coverage without being inefficient add a new env variable `DO_FEATURE_MATRIX` to the test script. This is how we do it over in `rust-secp256k1`, it enables good test coverage while not having to run the whole matrix in every CI job. Add cargo calls for each example because the current way we run the examples does not work for those who configure the build output directory to something other than the default.
1 parent 0457722 commit 3913a08

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

contrib/test.sh

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,29 @@ then
3131
exit 0
3232
fi
3333

34-
# Test without any features first
35-
cargo test --verbose
34+
# Defaults / sanity checks
35+
cargo test
3636

37-
# Test each feature
38-
for feature in ${FEATURES}
39-
do
40-
cargo test --verbose --features="$feature"
41-
done
37+
if [ "$DO_FEATURE_MATRIX" = true ]
38+
then
39+
# All features
40+
cargo test --features="$FEATURES"
41+
42+
# Single features
43+
for feature in ${FEATURES}
44+
do
45+
cargo test --features="$feature"
46+
done
4247

43-
# Also build and run each example to catch regressions
44-
cargo build --examples
45-
# run all examples
46-
run-parts ./target/debug/examples
48+
# Run all the examples
49+
cargo build --examples
50+
cargo run --example htlc --features=compiler
51+
cargo run --example parse
52+
cargo run --example sign_multisig
53+
cargo run --example verify_tx > /dev/null
54+
cargo run --example psbt
55+
cargo run --example xpub_descriptors
56+
fi
4757

4858
# Bench if told to (this only works with the nightly toolchain)
4959
if [ "$DO_BENCH" = true ]

0 commit comments

Comments
 (0)