Skip to content

Commit

Permalink
ci: run unit tests with sanitizers
Browse files Browse the repository at this point in the history
  • Loading branch information
mxinden committed Nov 27, 2024
1 parent e7ee5c6 commit 17eff13
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ jobs:
rust: beta
- os: windows-latest
rust: beta
- os: macos-latest
rust: nightly

runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -79,6 +77,28 @@ jobs:
run: >
cd url
&& cargo check --target aarch64-unknown-none -v --no-default-features
- name: Run tests with sanitizers
if: (matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest') && matrix.rust == 'nightly'
env:
RUST_LOG: trace
ASAN_OPTIONS: detect_leaks=1:detect_stack_use_after_return=1
run: |
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
sudo apt-get install -y --no-install-recommends llvm
TARGET="x86_64-unknown-linux-gnu"
SANITIZERS="address thread leak memory"
elif [ "${{ matrix.os }}" = "macos-latest" ]; then
# llvm-symbolizer (as part of llvm) is installed by default on macOS runners
TARGET="aarch64-apple-darwin"
# no memory and leak sanitizer support yet
SANITIZERS="address thread"
fi
for sanitizer in $SANITIZERS; do
echo "Running tests with $sanitizer sanitizer..."
export RUSTFLAGS="-Z sanitizer=$sanitizer"
export RUSTDOCFLAGS="$RUSTFLAGS"
cargo +nightly test -Z build-std --target "$TARGET"
done
WASM:
runs-on: ubuntu-latest
Expand Down

0 comments on commit 17eff13

Please sign in to comment.