Skip to content

Commit d86563e

Browse files
committed
ci: run unit tests with sanitizers
1 parent e7ee5c6 commit d86563e

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
@@ -79,6 +79,28 @@ jobs:
7979
run: >
8080
cd url
8181
&& cargo check --target aarch64-unknown-none -v --no-default-features
82+
- name: Run tests with sanitizers
83+
if: (matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest') && matrix.rust == 'nightly'
84+
env:
85+
RUST_LOG: trace
86+
ASAN_OPTIONS: detect_leaks=1:detect_stack_use_after_return=1
87+
run: |
88+
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
89+
sudo apt-get install -y --no-install-recommends llvm
90+
TARGET="x86_64-unknown-linux-gnu"
91+
SANITIZERS="address thread leak memory"
92+
elif [ "${{ matrix.os }}" = "macos-latest" ]; then
93+
# llvm-symbolizer (as part of llvm) is installed by default on macOS runners
94+
TARGET="aarch64-apple-darwin"
95+
# no memory and leak sanitizer support yet
96+
SANITIZERS="address thread"
97+
fi
98+
for sanitizer in $SANITIZERS; do
99+
echo "Running tests with $sanitizer sanitizer..."
100+
export RUSTFLAGS="-Z sanitizer=$sanitizer"
101+
export RUSTDOCFLAGS="$RUSTFLAGS"
102+
cargo +nightly test -Z build-std --target "$TARGET"
103+
done
82104
83105
WASM:
84106
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)