2525 rust : beta
2626 - os : windows-latest
2727 rust : beta
28- - os : macos-latest
29- rust : nightly
3028
3129 runs-on : ${{ matrix.os }}
3230
@@ -35,12 +33,21 @@ jobs:
3533 - uses : dtolnay/rust-toolchain@master
3634 with :
3735 toolchain : ${{ matrix.rust }}
36+ components : ${{ matrix.rust == 'nightly' && 'rust-src' || '' }}
3837 # Add toolchain for no_std tests
3938 - run : rustup toolchain install nightly
40- - name : Downgrade idna_adapter on Rust 1.63.0
39+ - name : Downgrade deps on Rust 1.63.0
4140 if : |
4241 matrix.rust == '1.63.0'
43- run : cargo update -p idna_adapter --precise 1.1.0
42+ run : |
43+ cargo update -p idna_adapter --precise 1.1.0
44+ - name : Downgrade deps on Rust 1.67.0
45+ if : |
46+ matrix.rust == '1.67.0'
47+ run : |
48+ cargo update -p zerofrom --precise 0.1.4
49+ cargo update -p yoke --precise 0.7.4
50+ cargo update -p litemap --precise 0.7.3
4451 - name : Add `aarch64-unknown-none` toolchain for `no_std` tests
4552 if : |
4653 matrix.os == 'ubuntu-latest' &&
7178 run : >
7279 cd url
7380 && cargo check --target aarch64-unknown-none -v --no-default-features
81+ - name : Run tests with sanitizers
82+ if : (matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest') && matrix.rust == 'nightly'
83+ env :
84+ ASAN_OPTIONS : detect_leaks=1:detect_stack_use_after_return=1
85+ run : |
86+ if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
87+ sudo apt-get install -y --no-install-recommends llvm
88+ TARGET="x86_64-unknown-linux-gnu"
89+ SANITIZERS="address thread leak memory"
90+ elif [ "${{ matrix.os }}" = "macos-latest" ]; then
91+ TARGET="aarch64-apple-darwin"
92+ # no memory and leak sanitizer support yet
93+ SANITIZERS="address thread"
94+ # Suppress non-crate leaks on macOS. TODO: Check occasionally if these are still needed.
95+ {
96+ echo "leak:dyld4::RuntimeState"
97+ echo "leak:fetchInitializingClassList"
98+ } > suppressions.txt
99+ export LSAN_OPTIONS="suppressions=$(pwd)/suppressions.txt"
100+ fi
101+ for sanitizer in $SANITIZERS; do
102+ echo "Running tests with $sanitizer sanitizer..."
103+ export RUSTFLAGS="-Z sanitizer=$sanitizer"
104+ export RUSTDOCFLAGS="$RUSTFLAGS"
105+ cargo +nightly test -Z build-std --target "$TARGET"
106+ done
74107
75108 WASM :
76109 runs-on : ubuntu-latest
0 commit comments