Skip to content

Commit

Permalink
cmake: set UBSAN options whenever we have a sanitized build
Browse files Browse the repository at this point in the history
  • Loading branch information
lzaoral committed Sep 12, 2023
1 parent 0e4db39 commit 02a1568
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ jobs:
- name: Build and check
run: |
if [[ "${{ matrix.version }}" == 22.04 ]]; then
# Make UBSAN print whole stack traces
export UBSAN_OPTIONS="print_stacktrace=1"
make distcheck-sanitizers
else
make distcheck
Expand Down
6 changes: 6 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ macro(add_test_wrap test_name cmd)

set_tests_properties(${test_name} PROPERTIES COST ${test_cost})
math(EXPR test_cost "${test_cost} - 1")

# print whole stacktrace for UBSAN reports
if(SANITIZERS)
set_property(TEST ${test_name} APPEND PROPERTY
ENVIRONMENT UBSAN_OPTIONS="print_stacktrace=1")
endif()
endmacro()

set(test_cost 1048576)
Expand Down

0 comments on commit 02a1568

Please sign in to comment.