|
25 | 25 | rust: beta
|
26 | 26 | - os: windows-latest
|
27 | 27 | rust: beta
|
28 |
| - - os: macos-latest |
29 |
| - rust: nightly |
30 | 28 |
|
31 | 29 | runs-on: ${{ matrix.os }}
|
32 | 30 |
|
|
35 | 33 | - uses: dtolnay/rust-toolchain@master
|
36 | 34 | with:
|
37 | 35 | toolchain: ${{ matrix.rust }}
|
| 36 | + components: ${{ matrix.rust == 'nightly' && 'rust-src' || '' }} |
38 | 37 | # Add toolchain for no_std tests
|
39 | 38 | - run: rustup toolchain install nightly
|
40 | 39 | - name: Downgrade deps on Rust 1.63.0
|
|
79 | 78 | run: >
|
80 | 79 | cd url
|
81 | 80 | && 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 |
82 | 107 |
|
83 | 108 | WASM:
|
84 | 109 | runs-on: ubuntu-latest
|
|
0 commit comments