Changeset View
Changeset View
Standalone View
Standalone View
cmake/modules/Sanitizers.cmake
Show All 35 Lines | function(enable_sanitizers) | ||||
add_compile_options(${_fsanitize_option}) | add_compile_options(${_fsanitize_option}) | ||||
add_link_options(${_fsanitize_option}) | add_link_options(${_fsanitize_option}) | ||||
include(TestSuite) | include(TestSuite) | ||||
set(SAN_SUPP_DIR "${CMAKE_SOURCE_DIR}/test/sanitizer_suppressions") | set(SAN_SUPP_DIR "${CMAKE_SOURCE_DIR}/test/sanitizer_suppressions") | ||||
if("address" IN_LIST ARGN) | if("address" IN_LIST ARGN) | ||||
add_test_environment(ASAN_OPTIONS "malloc_context_size=0:$ENV{ASAN_OPTIONS}") | add_test_environment(ASAN_OPTIONS "malloc_context_size=0:$ENV{ASAN_OPTIONS}") | ||||
add_test_environment(ASAN_OPTIONS "detect_stack_use_after_return=1:$ENV{ASAN_OPTIONS}") | |||||
add_test_environment(LSAN_OPTIONS "suppressions=${SAN_SUPP_DIR}/lsan:$ENV{LSAN_OPTIONS}") | add_test_environment(LSAN_OPTIONS "suppressions=${SAN_SUPP_DIR}/lsan:$ENV{LSAN_OPTIONS}") | ||||
endif() | endif() | ||||
if("thread" IN_LIST ARGN) | if("thread" IN_LIST ARGN) | ||||
add_test_environment(TSAN_OPTIONS "suppressions=${SAN_SUPP_DIR}/tsan:$ENV{TSAN_OPTIONS}") | add_test_environment(TSAN_OPTIONS "suppressions=${SAN_SUPP_DIR}/tsan:$ENV{TSAN_OPTIONS}") | ||||
endif() | endif() | ||||
if("undefined" IN_LIST ARGN) | if("undefined" IN_LIST ARGN) | ||||
add_test_environment(UBSAN_OPTIONS "suppressions=${SAN_SUPP_DIR}/ubsan:print_stacktrace=1:halt_on_error=1:$ENV{UBSAN_OPTIONS}") | add_test_environment(UBSAN_OPTIONS "suppressions=${SAN_SUPP_DIR}/ubsan:print_stacktrace=1:halt_on_error=1:$ENV{UBSAN_OPTIONS}") | ||||
endif() | endif() | ||||
endfunction() | endfunction() |