-
Notifications
You must be signed in to change notification settings - Fork 488
126 lines (111 loc) · 3.42 KB
/
sanitizers.yml
File metadata and controls
126 lines (111 loc) · 3.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: Sanitizers
on:
push:
branches: [master]
paths-ignore:
- "**.md"
- "docs/**"
- "LICENSE*"
- ".gitignore"
pull_request:
branches: [master]
paths-ignore:
- "**.md"
- "docs/**"
- "LICENSE*"
- ".gitignore"
workflow_dispatch:
jobs:
sanitizers:
strategy:
fail-fast: false
matrix:
include:
- os: macOS-latest
target: aarch64-apple-darwin
sanitizer: address
name: ASAN-macOS
- os: macOS-latest
target: aarch64-apple-darwin
sanitizer: thread
name: TSAN-macOS
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
sanitizer: address
name: ASAN-Linux
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
sanitizer: thread
name: TSAN-Linux
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
env:
RUSTFLAGS: -Zsanitizer=${{ matrix.sanitizer }}
RUSTDOCFLAGS: -Zsanitizer=${{ matrix.sanitizer }}
TSAN_OPTIONS: ${{ matrix.sanitizer == 'thread' && 'halt_on_error=0:history_size=7:second_deadlock_stack=1' || '' }}
ASAN_OPTIONS: ${{ matrix.sanitizer == 'address' && 'halt_on_error=0:detect_stack_use_after_return=1:check_initialization_order=1:strict_string_checks=1:detect_invalid_pointer_pairs=2:print_summary=1' || '' }}
steps:
- uses: actions/checkout@v5
- name: Cache Linux audio packages
if: runner.os == 'Linux'
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libasound2-dev libjack-jackd2-dev libjack-jackd2-0 libdbus-1-dev
- name: Install macOS dependencies
if: runner.os == 'macOS'
run: brew install llvm
- name: Install nightly Rust with rust-src
uses: dtolnay/rust-toolchain@nightly
with:
components: rust-src
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.name }}
- name: Run tests with sanitizer
run: |
cargo +nightly test \
-Zbuild-std \
--target ${{ matrix.target }} \
--lib --tests \
--verbose
- name: Check all examples with sanitizer
run: |
cargo +nightly check \
-Zbuild-std \
--target ${{ matrix.target }} \
--examples \
--verbose
- name: Build and run enumerate example with sanitizer
run: |
cargo +nightly run \
-Zbuild-std \
--target ${{ matrix.target }} \
--example enumerate \
--verbose
- name: Build and run beep example with sanitizer
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
cargo +nightly run \
-Zbuild-std \
--target ${{ matrix.target }} \
--example beep \
--verbose \
-- --device "alsa:null"
else
cargo +nightly run \
-Zbuild-std \
--target ${{ matrix.target }} \
--example beep \
--verbose
fi
- name: Upload sanitizer logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}-logs
path: |
*.log.*
/tmp/asan.*
/tmp/tsan.*
if-no-files-found: ignore