|
69 | 69 | run: cargo miri test |
70 | 70 | env: |
71 | 71 | MIRIFLAGS: "-Zmiri-disable-isolation" |
| 72 | + |
| 73 | + asan: |
| 74 | + name: ASAN - ${{ matrix.os }} |
| 75 | + runs-on: ${{ matrix.os }} |
| 76 | + strategy: |
| 77 | + fail-fast: false |
| 78 | + matrix: |
| 79 | + os: [ubuntu-24.04, windows-latest] |
| 80 | + |
| 81 | + steps: |
| 82 | + - uses: actions/checkout@v5 |
| 83 | + |
| 84 | + - name: Setup node |
| 85 | + uses: actions/setup-node@v5 |
| 86 | + with: |
| 87 | + node-version: 22 |
| 88 | + cache: 'yarn' |
| 89 | + |
| 90 | + - name: Install Rust |
| 91 | + uses: dtolnay/rust-toolchain@stable |
| 92 | + with: |
| 93 | + toolchain: nightly |
| 94 | + components: rust-src |
| 95 | + |
| 96 | + - name: Install dependencies |
| 97 | + run: yarn install --immutable --mode=skip-build |
| 98 | + |
| 99 | + - name: Download fixtures |
| 100 | + run: node download-fixtures.js |
| 101 | + env: |
| 102 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 103 | + |
| 104 | + - name: Test with ASAN (Linux) |
| 105 | + if: matrix.os == 'ubuntu-24.04' |
| 106 | + run: | |
| 107 | + LD_PRELOAD=/usr/lib/gcc/x86_64-linux-gnu/13/libasan.so cargo test |
| 108 | + env: |
| 109 | + RUST_TARGET: x86_64-unknown-linux-gnu |
| 110 | + RUST_BACKTRACE: 1 |
| 111 | + RUSTFLAGS: -Z sanitizer=address -C link-args=-Wl,-z,nodelete |
| 112 | + ASAN_OPTIONS: detect_leaks=1 |
| 113 | + |
| 114 | + - name: Test with ASAN (Windows) |
| 115 | + if: matrix.os == 'windows-latest' |
| 116 | + shell: pwsh |
| 117 | + run: | |
| 118 | + # Set ASAN environment variables for Windows |
| 119 | + $env:ASAN_OPTIONS = "windows_hook_rtl_allocators=true:detect_leaks=0:print_stats=1:check_initialization_order=true:strict_string_checks=true" |
| 120 | +
|
| 121 | + # Find and set the path to the ASAN runtime DLL |
| 122 | + $vsPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath |
| 123 | + $asanDllPath = Get-ChildItem -Path "$vsPath\VC\Tools\MSVC" -Recurse -Filter "clang_rt.asan_dynamic-x86_64.dll" | Select-Object -First 1 |
| 124 | + if ($asanDllPath) { |
| 125 | + $env:PATH = "$($asanDllPath.DirectoryName);$env:PATH" |
| 126 | + Write-Host "Found ASAN DLL at: $($asanDllPath.FullName)" |
| 127 | + } |
| 128 | + cargo test |
| 129 | + env: |
| 130 | + RUSTFLAGS: -Zsanitizer=address |
| 131 | + RUSTDOCFLAGS: -Zsanitizer=address |
| 132 | + RUST_BACKTRACE: 1 |
| 133 | + CARGO_PROFILE_DEV_OPT_LEVEL: 1 |
| 134 | + CARGO_UNSTABLE_BUILD_STD: std,panic_abort |
| 135 | + |
| 136 | + - name: Upload ASAN logs (Windows) |
| 137 | + if: failure() && matrix.os == 'windows-latest' |
| 138 | + uses: actions/upload-artifact@v4 |
| 139 | + with: |
| 140 | + name: windows-asan-logs |
| 141 | + path: | |
| 142 | + asan.log* |
| 143 | + *.asan.log |
| 144 | +
|
72 | 145 | bench: |
73 | 146 | strategy: |
74 | 147 | matrix: |
|
0 commit comments