|
| 1 | +name: TestASan |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + paths: |
| 8 | + - '**/*.rs' |
| 9 | + - '**/Cargo.toml' |
| 10 | + - '.github/workflows/ci_test_asan.yml' |
| 11 | + pull_request: |
| 12 | + branches: |
| 13 | + - master |
| 14 | + paths: |
| 15 | + - '**/*.rs' |
| 16 | + - '**/Cargo.toml' |
| 17 | + - '.github/workflows/ci_test_asan.yml' |
| 18 | + |
| 19 | +concurrency: |
| 20 | + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} |
| 21 | + cancel-in-progress: true |
| 22 | + |
| 23 | +env: |
| 24 | + RUST_BACKTRACE: 1 |
| 25 | + |
| 26 | +jobs: |
| 27 | + asan: |
| 28 | + runs-on: ${{ matrix.setup.os }} |
| 29 | + strategy: |
| 30 | + matrix: |
| 31 | + setup: |
| 32 | + - os: 'ubuntu-22.04' |
| 33 | + features: 'io-compat,sync,ring,codec-serde-json' |
| 34 | + target: 'x86_64-unknown-linux-gnu' |
| 35 | + - os: 'ubuntu-22.04' |
| 36 | + features: 'polling,io-compat,sync,ring,codec-serde-json' |
| 37 | + target: 'x86_64-unknown-linux-gnu' |
| 38 | + - os: 'ubuntu-22.04' |
| 39 | + features: 'polling,io-compat,sync,ring,codec-serde-json' |
| 40 | + no_default_features: true |
| 41 | + target: 'x86_64-unknown-linux-gnu' |
| 42 | + steps: |
| 43 | + - uses: actions/checkout@v4 |
| 44 | + - name: Setup nightly toolchain with rust-src |
| 45 | + run: rustup toolchain install nightly --component rust-src |
| 46 | + - name: Setup target |
| 47 | + if: ${{ matrix.setup.target }} |
| 48 | + run: rustup +nightly target install ${{ matrix.setup.target }} |
| 49 | + - name: Run ASan tests |
| 50 | + run: | |
| 51 | + set -ex |
| 52 | +
|
| 53 | + ARGS=("--features" "all,nightly") |
| 54 | +
|
| 55 | + # Add features if features is not empty |
| 56 | + if [[ -n "${{ matrix.setup.features }}" ]]; then |
| 57 | + ARGS+=("--features" "${{ matrix.setup.features }}") |
| 58 | + fi |
| 59 | + # Add no-default-features if no_default_features is true |
| 60 | + if [[ -n "${{ matrix.setup.no_default_features }}" ]]; then |
| 61 | + ARGS+=("--no-default-features") |
| 62 | + fi |
| 63 | + # Specify target if target is not empty |
| 64 | + if [[ -n "${{ matrix.setup.target }}" ]]; then |
| 65 | + ARGS+=("--target" "${{ matrix.setup.target }}") |
| 66 | + fi |
| 67 | +
|
| 68 | + cargo +nightly test --workspace --tests --lib -Zbuild-std "${ARGS[@]}" |
| 69 | + env: |
| 70 | + RUSTFLAGS: -Zsanitizer=address |
0 commit comments