Merge rust-bitcoin/rust-secp256k1#422: Fix test script silent failure

97dc0ea9ac Run correct clang --version (Tobin Harding)
a3582ff77d test.sh: Use set -e to exit on failure (Tobin Harding)
7bec31c3a6 test.sh: explicitly return 0 (Tobin Harding)

Pull request description:

  Change the test script to exit with non-zero status code if any command fails.

  The `test.sh` script is silently failing, that means changes causing failures are slipping through our CI pipeline and being merged.

  Resolves: #419

  ## Note

  Just the last 3 patches, the first 6 are from #420. re-base just shows it works on top of 420, it is going to have to be rebased again when 420 merges.

ACKs for top commit:
  apoelstra:
    ACK 97dc0ea9ac

Tree-SHA512: b86a6876d8c45a2b90b7b3c8adbc08ad6f49b430b1cfaec31cd2de8441cb96af39c63da02b98d6ed71dfab045d466d71d3757297886b5e44ebb6cbaeb4ed32dd
This commit is contained in:
Andrew Poelstra 2022-04-01 17:12:42 +00:00
commit e4fb575590
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 12 additions and 8 deletions

View File

@ -1,5 +1,7 @@
#!/bin/sh -ex #!/bin/sh -ex
set -e
# TODO: Add "alloc" once we bump MSRV to past 1.29 # 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"
# These features are typically enabled along with the 'std' feature, so we test # These features are typically enabled along with the 'std' feature, so we test
@ -67,24 +69,25 @@ fi
# Webassembly stuff # Webassembly stuff
if [ "$DO_WASM" = true ]; then if [ "$DO_WASM" = true ]; then
clang --version && clang-9 --version
CARGO_TARGET_DIR=wasm cargo install --force wasm-pack && CARGO_TARGET_DIR=wasm cargo install --force wasm-pack
printf '\n[lib]\ncrate-type = ["cdylib", "rlib"]\n' >> Cargo.toml && printf '\n[lib]\ncrate-type = ["cdylib", "rlib"]\n' >> Cargo.toml
CC=clang-9 wasm-pack build && CC=clang-9 wasm-pack build
CC=clang-9 wasm-pack test --node; CC=clang-9 wasm-pack test --node
fi fi
# Address Sanitizer # Address Sanitizer
if [ "$DO_ASAN" = true ]; then if [ "$DO_ASAN" = true ]; then
clang --version
cargo clean cargo clean
CC='clang -fsanitize=address -fno-omit-frame-pointer' \ CC='clang -fsanitize=address -fno-omit-frame-pointer' \
RUSTFLAGS='-Zsanitizer=address -Clinker=clang -Cforce-frame-pointers=yes' \ RUSTFLAGS='-Zsanitizer=address -Clinker=clang -Cforce-frame-pointers=yes' \
ASAN_OPTIONS='detect_leaks=1 detect_invalid_pointer_pairs=1 detect_stack_use_after_return=1' \ ASAN_OPTIONS='detect_leaks=1 detect_invalid_pointer_pairs=1 detect_stack_use_after_return=1' \
cargo test --lib --all --features="$FEATURES" -Zbuild-std --target x86_64-unknown-linux-gnu && cargo test --lib --all --features="$FEATURES" -Zbuild-std --target x86_64-unknown-linux-gnu
cargo clean && cargo clean
CC='clang -fsanitize=memory -fno-omit-frame-pointer' \ CC='clang -fsanitize=memory -fno-omit-frame-pointer' \
RUSTFLAGS='-Zsanitizer=memory -Zsanitizer-memory-track-origins -Cforce-frame-pointers=yes' \ RUSTFLAGS='-Zsanitizer=memory -Zsanitizer-memory-track-origins -Cforce-frame-pointers=yes' \
cargo test --lib --all --features="$FEATURES" -Zbuild-std --target x86_64-unknown-linux-gnu && cargo test --lib --all --features="$FEATURES" -Zbuild-std --target x86_64-unknown-linux-gnu
cargo run --release --manifest-path=./no_std_test/Cargo.toml | grep -q "Verified Successfully" cargo run --release --manifest-path=./no_std_test/Cargo.toml | grep -q "Verified Successfully"
cargo run --release --features=alloc --manifest-path=./no_std_test/Cargo.toml | grep -q "Verified alloc Successfully" cargo run --release --features=alloc --manifest-path=./no_std_test/Cargo.toml | grep -q "Verified alloc Successfully"
fi fi
@ -94,3 +97,4 @@ if [ "$DO_BENCH" = true ]; then
cargo bench --all --features="unstable" cargo bench --all --features="unstable"
fi fi
exit 0