Skip to content

Commit c999b60

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 e64c7d5 commit c999b60

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
@@ -67,11 +69,11 @@ fi
6769

6870
# Webassembly stuff
6971
if [ "$DO_WASM" = true ]; then
70-
clang --version &&
71-
CARGO_TARGET_DIR=wasm cargo install --force wasm-pack &&
72-
printf '\n[lib]\ncrate-type = ["cdylib", "rlib"]\n' >> Cargo.toml &&
73-
CC=clang-9 wasm-pack build &&
74-
CC=clang-9 wasm-pack test --node;
72+
clang --version
73+
CARGO_TARGET_DIR=wasm cargo install --force wasm-pack
74+
printf '\n[lib]\ncrate-type = ["cdylib", "rlib"]\n' >> Cargo.toml
75+
CC=clang-9 wasm-pack build
76+
CC=clang-9 wasm-pack test --node
7577
fi
7678

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

0 commit comments

Comments
 (0)