Skip to content

Commit

Permalink
BUG: Fixed ASAN CI test discovery and leak detection (#1037)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
JDuffeyBQ authored Aug 6, 2024
1 parent 76b2c2c commit 9113966
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/asan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ jobs:
build:
env:
VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite'
CC: clang-14
CXX: clang++-14
runs-on: ubuntu-22.04
steps:
- name: Checkout
Expand Down Expand Up @@ -44,17 +46,14 @@ jobs:
setapikey "${{secrets.GITHUB_TOKEN}}" \
-source "https://nuget.pkg.github.com/BlueQuartzSoftware/index.json"
- name: Configure
env:
CC: clang-14
CXX: clang++-14
run: |
cmake --preset ci-asan ${{github.workspace}}
- name: Build
run: |
export LD_LIBRARY_PATH=$($CXX -print-file-name=libclang_rt.asan-x86_64.so)
cmake --build --preset ci-asan
- name: Test
run: |
export LD_PRELOAD=$(clang++-14 -print-file-name=libclang_rt.asan-x86_64.so)
ctest --preset ci-asan -E "PY"
export ASAN_OPTIONS=detect_leaks=0
ctest --preset ci-asan -R "PY"
export LD_PRELOAD=$($CXX -print-file-name=libclang_rt.asan-x86_64.so)
export LSAN_OPTIONS=suppressions=${{github.workspace}}/utilites/leak_suppressions.txt
ctest --preset ci-asan
3 changes: 3 additions & 0 deletions utilities/leak_suppressions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
leak:pybind11.h
leak:/usr/bin
leak:site-packages/

0 comments on commit 9113966

Please sign in to comment.