1919 matrix :
2020 os : [ubuntu-24.04]
2121 sys :
22- - {compiler: clang, version: '19', name: asan}
23- - {compiler: clang, version: '21', name: asan}
22+ - {compiler: clang, version: '21', name: asan, sanitizer: address}
23+ - {compiler: clang, version: '21', name: msan, sanitizer: memory}
24+ - {compiler: clang, version: '21', name: lsan, sanitizer: leak}
25+ - {compiler: clang, version: '21', name: ubsan, sanitizer: undefined}
2426 config :
2527 - {name: Debug}
2628
6062 -DCMAKE_BUILD_TYPE=${{matrix.config.name}} \
6163 -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
6264 -DBUILD_TESTS=ON \
63- -DUSE_SANITIZER=address
65+ -DUSE_SANITIZER=${{ matrix.sys.sanitizer }}
6466
6567 - name : Build tests
6668 working-directory : build
@@ -69,30 +71,44 @@ jobs:
6971 - name : Run tests
7072 working-directory : build
7173 run : |
72- export ASAN_OPTIONS=log_path=asan_log_:alloc_dealloc_mismatch=0:halt_on_error=0:handle_abort=0
73- export ASAN_SAVE_DUMPS=AsanDump.dmp
74+ SAN=${{ matrix.sys.sanitizer }}
75+ case "$SAN" in
76+ address)
77+ export ASAN_OPTIONS=log_path=asan_log_:alloc_dealloc_mismatch=0:halt_on_error=0:handle_abort=0
78+ export ASAN_SAVE_DUMPS=AsanDump.dmp
79+ ;;
80+ memory)
81+ export MSAN_OPTIONS=log_path=msan_log_:halt_on_error=0
82+ ;;
83+ leak)
84+ export LSAN_OPTIONS=log_path=lsan_log_:halt_on_error=0
85+ ;;
86+ undefined)
87+ export UBSAN_OPTIONS=log_path=ubsan_log_:halt_on_error=0:print_stacktrace=1
88+ ;;
89+ esac
7490 ctest -R ^xtest$ --output-on-failure
7591
76- - name : Upload ASAN log
92+ - name : Upload sanitizer log
7793 if : always()
7894 uses : actions/upload-artifact@v6
7995 with :
80- name : asan -log-${{ matrix.sys.compiler }}-${{ matrix.sys.version }}-${{ matrix.config.name }}-${{ runner.os }}
81- path : ' **/asan_log_ *'
96+ name : sanitizer -log-${{ matrix.sys.sanitizer }} -${{ matrix.sys.compiler }}-${{ matrix.sys.version }}-${{ matrix.config.name }}-${{ runner.os }}
97+ path : ' **/*san_log_ *'
8298 if-no-files-found : ignore
8399
84- - name : Upload ASAN dump
100+ - name : Upload sanitizer dump
85101 if : always()
86102 uses : actions/upload-artifact@v6
87103 with :
88- name : asan -dump-${{ matrix.sys.compiler }}-${{ matrix.sys.version }}-${{ matrix.config.name }}-${{ runner.os }}
104+ name : sanitizer -dump-${{ matrix.sys.sanitizer }} -${{ matrix.sys.compiler }}-${{ matrix.sys.version }}-${{ matrix.config.name }}-${{ runner.os }}
89105 path : ' **/AsanDump.dmp'
90106 if-no-files-found : ignore
91107
92- - name : Return errors if ASAN log content is not empty
108+ - name : Return errors if sanitizer log content is not empty
93109 if : always()
94110 run : |
95- if [ -n "$(find build/test -name 'asan_log_ *' -type f -size +0 2>/dev/null)" ]; then
96- echo "ASAN detected errors. See the log for details."
111+ if [ -n "$(find build/test -name '*san_log_ *' -type f -size +0 2>/dev/null)" ]; then
112+ echo "Sanitizer detected errors. See the log for details."
97113 exit 1
98114 fi
0 commit comments