Skip to content

Commit 36fe041

Browse files
committed
ci: run unit tests with sanitizers
1 parent 797b2e2 commit 36fe041

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

.github/workflows/main.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,28 @@ jobs:
7171
run: >
7272
cd url
7373
&& cargo check --target aarch64-unknown-none -v --no-default-features
74+
- name: Run tests with sanitizers
75+
if: (matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest') && matrix.rust == 'nightly'
76+
env:
77+
RUST_LOG: trace
78+
ASAN_OPTIONS: detect_leaks=1:detect_stack_use_after_return=1
79+
run: |
80+
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
81+
sudo apt-get install -y --no-install-recommends llvm
82+
TARGET="x86_64-unknown-linux-gnu"
83+
SANITIZERS="address thread leak memory"
84+
elif [ "${{ matrix.os }}" = "macos-latest" ]; then
85+
# llvm-symbolizer (as part of llvm) is installed by default on macOS runners
86+
TARGET="aarch64-apple-darwin"
87+
# no memory and leak sanitizer support yet
88+
SANITIZERS="address thread"
89+
fi
90+
for sanitizer in $SANITIZERS; do
91+
echo "Running tests with $sanitizer sanitizer..."
92+
export RUSTFLAGS="-Z sanitizer=$sanitizer"
93+
export RUSTDOCFLAGS="$RUSTFLAGS"
94+
cargo +nightly test -Z build-std --target "$TARGET"
95+
done
7496
7597
WASM:
7698
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)