Skip to content

Commit a349619

Browse files
committed
test.sh: Use set -e to exit on failure
Currently the `test.sh` script is silently failing because we do not exit if a command fails. We can achieve this by using the Bash builtin `set -e`. For some reason I cannot explain a chain of commands that fails does not fail the script. Instead of working out _why_ just remove the chain and run each command on its own. This is functionally the same and, I hazard a guess, is what the original author hoped to achieve with the chaining.
1 parent 2805f74 commit a349619

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

contrib/test.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/sh -ex
22

3+
set -e
4+
35
# TODO: Add "alloc" once we bump MSRV to past 1.29
46
FEATURES="bitcoin_hashes global-context lowmemory rand recovery serde std"
57
# These features are typically enabled along with the 'std' feature, so we test
@@ -64,11 +66,11 @@ fi
6466

6567
# Webassembly stuff
6668
if [ "$DO_WASM" = true ]; then
67-
clang --version &&
68-
CARGO_TARGET_DIR=wasm cargo install --force wasm-pack &&
69-
printf '\n[lib]\ncrate-type = ["cdylib", "rlib"]\n' >> Cargo.toml &&
70-
CC=clang-9 wasm-pack build &&
71-
CC=clang-9 wasm-pack test --node;
69+
clang --version
70+
CARGO_TARGET_DIR=wasm cargo install --force wasm-pack
71+
printf '\n[lib]\ncrate-type = ["cdylib", "rlib"]\n' >> Cargo.toml
72+
CC=clang-9 wasm-pack build
73+
CC=clang-9 wasm-pack test --node
7274
fi
7375

7476
# Address Sanitizer
@@ -77,11 +79,11 @@ if [ "$DO_ASAN" = true ]; then
7779
CC='clang -fsanitize=address -fno-omit-frame-pointer' \
7880
RUSTFLAGS='-Zsanitizer=address -Clinker=clang -Cforce-frame-pointers=yes' \
7981
ASAN_OPTIONS='detect_leaks=1 detect_invalid_pointer_pairs=1 detect_stack_use_after_return=1' \
80-
cargo test --lib --all --features="$FEATURES" -Zbuild-std --target x86_64-unknown-linux-gnu &&
81-
cargo clean &&
82+
cargo test --lib --all --features="$FEATURES" -Zbuild-std --target x86_64-unknown-linux-gnu
83+
cargo clean
8284
CC='clang -fsanitize=memory -fno-omit-frame-pointer' \
8385
RUSTFLAGS='-Zsanitizer=memory -Zsanitizer-memory-track-origins -Cforce-frame-pointers=yes' \
84-
cargo test --lib --all --features="$FEATURES" -Zbuild-std --target x86_64-unknown-linux-gnu &&
86+
cargo test --lib --all --features="$FEATURES" -Zbuild-std --target x86_64-unknown-linux-gnu
8587
cargo run --release --manifest-path=./no_std_test/Cargo.toml | grep -q "Verified Successfully"
8688
cargo run --release --features=alloc --manifest-path=./no_std_test/Cargo.toml | grep -q "Verified alloc Successfully"
8789
fi

0 commit comments

Comments
 (0)