From 1194591fa1704822a77a6dc735a1ddd0be9728ee Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Fri, 22 Jul 2022 11:30:53 +1000 Subject: [PATCH 1/5] Use set -ex instead of /bin/sh -ex Simply because it is subjectively more typical and easier to see; use `set -ex` instead of `-ex` on the shebang line. --- contrib/test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/test.sh b/contrib/test.sh index 7933a53..9dcea78 100755 --- a/contrib/test.sh +++ b/contrib/test.sh @@ -1,6 +1,6 @@ -#!/bin/sh -ex +#!/bin/sh -set -e +set -ex # TODO: Add "alloc" once we bump MSRV to past 1.29 FEATURES="bitcoin_hashes global-context lowmemory rand recovery serde std" From d14cccbad52852ff6f2b45f61c998a34ae6f2c79 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Fri, 22 Jul 2022 11:31:54 +1000 Subject: [PATCH 2/5] Add alloc to features Remove the comment and add "alloc" to the features list now that we have bumped the MSRV. --- contrib/test.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/contrib/test.sh b/contrib/test.sh index 9dcea78..8eb7d3f 100755 --- a/contrib/test.sh +++ b/contrib/test.sh @@ -2,8 +2,7 @@ set -ex -# TODO: Add "alloc" once we bump MSRV to past 1.29 -FEATURES="bitcoin_hashes global-context lowmemory rand recovery serde std" +FEATURES="bitcoin_hashes global-context lowmemory rand recovery serde std alloc" # These features are typically enabled along with the 'std' feature, so we test # them together with 'std'. STD_FEATURES="rand-std bitcoin-hashes-std" From c8dc4b64105f5e4839012cc5b119d66fd97c9f6a Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Fri, 22 Jul 2022 11:32:51 +1000 Subject: [PATCH 3/5] Remove TOOLCHAIN We can use the already provided `RUSTUP_TOOLCHAIN` to control the Rust toolchain, no need for our own custom env variable. --- contrib/test.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/contrib/test.sh b/contrib/test.sh index 8eb7d3f..dad931a 100755 --- a/contrib/test.sh +++ b/contrib/test.sh @@ -7,12 +7,6 @@ FEATURES="bitcoin_hashes global-context lowmemory rand recovery serde std alloc" # them together with 'std'. STD_FEATURES="rand-std bitcoin-hashes-std" -# Use toolchain if explicitly specified -if [ -n "$TOOLCHAIN" ] -then - alias cargo="cargo +$TOOLCHAIN" -fi - cargo --version rustc --version From bf95a02263b542da2a2b8e0072c7931f6aff3910 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Fri, 22 Jul 2022 11:35:15 +1000 Subject: [PATCH 4/5] Use the STD_FEATURES list We define a list of features that should be tested along with "std" but we don't actually use it. Add a call to `cargo test` that enables "std" and all the features from `STD_FEATURES`. Found by `shellcheck`. --- contrib/test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/test.sh b/contrib/test.sh index dad931a..e254084 100755 --- a/contrib/test.sh +++ b/contrib/test.sh @@ -49,6 +49,7 @@ if [ "$DO_FEATURE_MATRIX" = true ]; then RUSTFLAGS='--cfg=fuzzing' RUSTDOCFLAGS=$RUSTFLAGS cargo test --all RUSTFLAGS='--cfg=fuzzing' RUSTDOCFLAGS=$RUSTFLAGS cargo test --all --features="$FEATURES" cargo test --all --features="rand serde" + cargo test --features="$STD_FEATURES" if [ "$NIGHTLY" = true ]; then cargo test --all --all-features From 1bbc1e7628eeab1c3d2637f44069e15c3266caee Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Fri, 22 Jul 2022 11:37:43 +1000 Subject: [PATCH 5/5] Explicitly set RUSTDOCFLAGS shellcheck emits these two warnings: SC2097: This assignment is only seen by the forked process. SC2098: This expansion will not see the mentioned assignment. Set `RUSTDOCFLAGS` explicitly to `--cfg=fuzzing` instead of trying to use the `RUSTFLAGS` variable. --- contrib/test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/test.sh b/contrib/test.sh index e254084..fca682d 100755 --- a/contrib/test.sh +++ b/contrib/test.sh @@ -46,8 +46,8 @@ if [ "$DO_FEATURE_MATRIX" = true ]; then cargo test --all --no-default-features --features="std,$feature" done # Other combos - RUSTFLAGS='--cfg=fuzzing' RUSTDOCFLAGS=$RUSTFLAGS cargo test --all - RUSTFLAGS='--cfg=fuzzing' RUSTDOCFLAGS=$RUSTFLAGS cargo test --all --features="$FEATURES" + RUSTFLAGS='--cfg=fuzzing' RUSTDOCFLAGS='--cfg=fuzzing' cargo test --all + RUSTFLAGS='--cfg=fuzzing' RUSTDOCFLAGS='--cfg=fuzzing' cargo test --all --features="$FEATURES" cargo test --all --features="rand serde" cargo test --features="$STD_FEATURES"