53ee42d7c1 Fix ASAN in CI (Tobin C. Harding)

Pull request description:

  When we merged `hashes` into `rust-bitcoin` we ran the test script a couple of times using `./hashes/contrib/test.sh` this causes the `cargo` commands in the CI script to be run from the crate root which is not what we want.

  This showed up recently because `cargo test` was getting run in `bitcoin` after building with address/memory sanitazation configured into the build.

  While we are at it run `cargo clean` after the last sanitizer build just to future proof the CI script in case we later accidentally re-use the same build with plain old `cargo` (without `-Zbuild-std etc.`).

ACKs for top commit:
  apoelstra:
    ACK 53ee42d7c1
  sanket1729:
    ACK 53ee42d7c1

Tree-SHA512: 3d0b9aa35be6290808e2d23144e4dce467ab433862b375e1f164dc41261919e8e27e4cab117bbe9bfe18814ec7bf468e1c03674d20e9f36b5319e986fc329e89
This commit is contained in:
sanket1729 2023-01-20 07:11:58 -08:00
commit d66ee48482
No known key found for this signature in database
GPG Key ID: 648FFB183E0870A2
2 changed files with 4 additions and 2 deletions

View File

@ -157,7 +157,7 @@ jobs:
- name: Running address sanitizer
env:
DO_ASAN: true
run: ./hashes/contrib/test.sh
run: cd hashes && ./contrib/test.sh
WASM:
name: WebAssembly Build # hashes crate only.
@ -170,4 +170,4 @@ jobs:
- name: Running WASM build
env:
DO_WASM: true
run: ./hashes/contrib/test.sh
run: cd hashes && ./contrib/test.sh

View File

@ -81,6 +81,8 @@ if [ "$DO_ASAN" = true ]; then
CC='clang -fsanitize=memory -fno-omit-frame-pointer' \
RUSTFLAGS='-Zsanitizer=memory -Zsanitizer-memory-track-origins -Cforce-frame-pointers=yes' \
cargo test --lib --no-default-features --features="$FEATURES" -Zbuild-std --target x86_64-unknown-linux-gnu
# Cleanup because we do not want to use a build that used these build flags again.
cargo clean
fi
# Bench if told to, only works with non-stable toolchain (nightly, beta).