Skip to content

Commit 5274e3d

Browse files
committed
cmake: set UBSAN options whenever we have a sanitized build
1 parent be20b75 commit 5274e3d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ jobs:
4040
- name: Build and check
4141
run: |
4242
if [[ "${{ matrix.version }}" == 22.04 ]]; then
43-
# Make UBSAN print whole stack traces
44-
export UBSAN_OPTIONS="print_stacktrace=1"
4543
make distcheck-sanitizers
4644
else
4745
make distcheck

tests/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ macro(add_test_wrap test_name cmd)
3434

3535
set_tests_properties(${test_name} PROPERTIES COST ${test_cost})
3636
math(EXPR test_cost "${test_cost} - 1")
37+
38+
# print whole stacktrace for UBSAN reports
39+
if(SANITIZERS)
40+
set_property(TEST ${test_name} APPEND PROPERTY
41+
ENVIRONMENT UBSAN_OPTIONS="print_stacktrace=1")
42+
endif()
3743
endmacro()
3844

3945
set(test_cost 1048576)

0 commit comments

Comments
 (0)