Skip to content

Commit 9113966

Browse files
authored
BUG: Fixed ASAN CI test discovery and leak detection (#1037)
* Fixed issue with catch2 test discovery for asan CI * Catch2 runs the test executable in order to discover the tests but the executable couldn't find the clang asan library in the build step * Added leak suppressions file for LeakSanitizer * Ignore leaks detected in: * "/usr/bin" e.g. bash and python * "site-packages/" e.g. numpy * "pybind11.h" * Currently having an issue with leaking enum bindings * pybind/pybind11#3865 Signed-off-by: Jared Duffey <[email protected]>
1 parent 76b2c2c commit 9113966

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

.github/workflows/asan.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ jobs:
88
build:
99
env:
1010
VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite'
11+
CC: clang-14
12+
CXX: clang++-14
1113
runs-on: ubuntu-22.04
1214
steps:
1315
- name: Checkout
@@ -44,17 +46,14 @@ jobs:
4446
setapikey "${{secrets.GITHUB_TOKEN}}" \
4547
-source "https://nuget.pkg.github.com/BlueQuartzSoftware/index.json"
4648
- name: Configure
47-
env:
48-
CC: clang-14
49-
CXX: clang++-14
5049
run: |
5150
cmake --preset ci-asan ${{github.workspace}}
5251
- name: Build
5352
run: |
53+
export LD_LIBRARY_PATH=$($CXX -print-file-name=libclang_rt.asan-x86_64.so)
5454
cmake --build --preset ci-asan
5555
- name: Test
5656
run: |
57-
export LD_PRELOAD=$(clang++-14 -print-file-name=libclang_rt.asan-x86_64.so)
58-
ctest --preset ci-asan -E "PY"
59-
export ASAN_OPTIONS=detect_leaks=0
60-
ctest --preset ci-asan -R "PY"
57+
export LD_PRELOAD=$($CXX -print-file-name=libclang_rt.asan-x86_64.so)
58+
export LSAN_OPTIONS=suppressions=${{github.workspace}}/utilites/leak_suppressions.txt
59+
ctest --preset ci-asan

utilities/leak_suppressions.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
leak:pybind11.h
2+
leak:/usr/bin
3+
leak:site-packages/

0 commit comments

Comments
 (0)