Skip to content

Commit 57782e5

Browse files
committed
Add sanitizer checks to GH workflows
1 parent 3809b3a commit 57782e5

File tree

1 file changed

+42
-5
lines changed

1 file changed

+42
-5
lines changed

.github/workflows/basic.yml

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@ jobs:
1717
pool_tracking: ['ON', 'OFF']
1818
shared_library: ['OFF']
1919
os_provider: ['ON']
20+
sanitizers: [{asan: 'OFF', ubsan: 'OFF', tsan: 'OFF'}]
2021
include:
2122
- os: 'ubuntu-20.04'
2223
build_type: Release
2324
compiler: {c: gcc-7, cxx: g++-7}
2425
shared_library: 'OFF'
2526
- os: 'ubuntu-22.04'
2627
build_type: Release
27-
compiler: {c: clang, cxx: clang++}
28+
compiler: {c: clang, cxx: clang++}
2829
shared_library: 'OFF'
2930
- os: 'ubuntu-22.04'
3031
build_type: Release
@@ -42,17 +43,34 @@ jobs:
4243
compiler: {c: gcc, cxx: g++}
4344
shared_library: 'OFF'
4445
os_provider: 'OFF'
46+
# TODO: Enable sanitizer checks with pool tracking enabled. There's
47+
# a leak reported by sanitizer in jemalloc pool implementation that
48+
# points to a tracker_value_t not being free'd.
49+
# TODO: Move jobs with sanitizer checks to a separate workflow file.
50+
- os: 'ubuntu-22.04'
51+
build_type: Debug
52+
compiler: {c: clang, cxx: clang++}
53+
pool_tracking: 'OFF'
54+
shared_library: 'OFF'
55+
# TSAN is mutually exclusive with other sanitizers
56+
sanitizers: [{asan: 'ON', ubsan: 'ON', tsan: 'OFF'}, {asan: 'OFF', ubsan: 'OFF', tsan: 'ON'}]
57+
- os: 'ubuntu-22.04'
58+
build_type: Debug
59+
compiler: {c: gcc, cxx: g++}
60+
pool_tracking: 'OFF'
61+
shared_library: 'OFF'
62+
sanitizers: [{asan: 'ON', ubsan: 'ON', tsan: 'OFF'}, {asan: 'OFF', ubsan: 'OFF', tsan: 'ON'}]
4563
runs-on: ${{matrix.os}}
4664

4765
steps:
4866
- name: Checkout
4967
uses: actions/checkout@v4
50-
68+
5169
- name: Install apt packages
5270
run: |
5371
sudo apt-get update
5472
sudo apt-get install -y clang cmake libnuma-dev libjemalloc-dev libtbb-dev
55-
73+
5674
- name: Install g++-7
5775
if: matrix.compiler.cxx == 'g++-7'
5876
run: |
@@ -74,11 +92,14 @@ jobs:
7492
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
7593
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
7694
-DUMF_BUILD_LIBUMF_POOL_SCALABLE=ON
95+
-DUSE_ASAN=${{matrix.sanitizers.asan}}
96+
-DUSE_UBSAN=${{matrix.sanitizers.ubsan}}
97+
-DUSE_TSAN=${{matrix.sanitizers.tsan}}
7798
7899
- name: Build UMF
79100
run: |
80101
cmake --build ${{env.BUILD_DIR}} -j $(nproc)
81-
102+
82103
- name: Run tests
83104
working-directory: ${{env.BUILD_DIR}}
84105
run: |
@@ -102,6 +123,8 @@ jobs:
102123
compiler: [{c: cl, cxx: cl}]
103124
pool_tracking: ['ON', 'OFF']
104125
shared_library: ['OFF']
126+
# ASAN is the only available sanitizer on Windows
127+
sanitizers: [{asan: 'OFF'}]
105128
include:
106129
- os: 'windows-2022'
107130
build_type: Release
@@ -113,6 +136,19 @@ jobs:
113136
compiler: {c: cl, cxx: cl}
114137
pool_tracking: 'ON'
115138
shared_library: 'ON'
139+
- os: 'windows-2022'
140+
build_type: Debug
141+
compiler: {c: clang-cl, cxx: clang-cl}
142+
pool_tracking: 'OFF'
143+
shared_library: 'OFF'
144+
sanitizers: [{asan: 'ON'}]
145+
- os: 'windows-2022'
146+
build_type: Debug
147+
compiler: {c: cl, cxx: cl}
148+
pool_tracking: 'OFF'
149+
shared_library: 'OFF'
150+
sanitizers: [{asan: 'ON'}]
151+
116152
runs-on: ${{matrix.os}}
117153

118154
steps:
@@ -130,6 +166,7 @@ jobs:
130166
-DUMF_FORMAT_CODE_STYLE=OFF
131167
-DUMF_DEVELOPER_MODE=ON
132168
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
169+
-DUSE_ASAN=${{matrix.sanitizers.asan}}
133170
134171
- name: Build UMF
135172
run: cmake --build ${{env.BUILD_DIR}} --config ${{matrix.build_type}} -j $Env:NUMBER_OF_PROCESSORS
@@ -160,7 +197,7 @@ jobs:
160197
-DUMF_DEVELOPER_MODE=ON
161198
-DUMF_ENABLE_POOL_TRACKING=ON
162199
163-
- name: Run code-style check
200+
- name: Run code-style check
164201
run: |
165202
cmake --build ${{env.BUILD_DIR}} --target clang-format-check
166203

0 commit comments

Comments
 (0)