Skip to content

Commit 0df00c8

Browse files
committed
Suppress sanitizer errors about memory leaks in tbb init in older tbb versions
Signed-off-by: Nick Avramoussis <[email protected]>
1 parent fc7843c commit 0df00c8

File tree

3 files changed

+29
-11
lines changed

3 files changed

+29
-11
lines changed

cmake/scripts/lsan.supp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#################################################################################
2+
## This file is loaded by the Leak/Address Sanitizer build for the unit tests. ##
3+
## It can be used to ignore various errors reported by the sanitizer. This is ##
4+
## especially useful with upstream issues (e.g. boost/tbb). For help defining ##
5+
## suppression rules, see: ##
6+
## https://clang.llvm.org/docs/AddressSanitizer.html ##
7+
## The build is configured with CMAKE_BUILD_TYPE=asan or lsan ##
8+
#################################################################################
9+
10+
##### Upstream #####
11+
12+
# Leaks from TBB init which occur due to tbb teardown issues
13+
# https://github.com/oneapi-src/oneTBB/issues/206
14+
# Should be fixed in oneTBB. Ignore them for now
15+
leak:tbb::internal::task_stream<3>::initialize*

openvdb/openvdb/unittest/CMakeLists.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,16 @@ endif()
221221
target_link_libraries(vdb_test ${OPENVDB_TEST_DEPENDENT_LIBS})
222222
add_test(NAME vdb_unit_test COMMAND $<TARGET_FILE:vdb_test> -v)
223223

224-
# For the undefined behaviour sanitizer, add the suppression file and
225-
# additional options
226-
224+
# For the sanitizers, add the suppression files and additional options
227225
get_filename_component(PATH_TO_PROJECT_ROOT ${CMAKE_CURRENT_LIST_DIR} DIRECTORY)
228226
get_filename_component(PATH_TO_PROJECT_ROOT ${PATH_TO_PROJECT_ROOT} DIRECTORY)
229227
get_filename_component(PATH_TO_PROJECT_ROOT ${PATH_TO_PROJECT_ROOT} DIRECTORY)
228+
set(LSAN_SUPRESSION_FILE ${PATH_TO_PROJECT_ROOT}/cmake/scripts/lsan.supp)
230229
set(UBSAN_SUPRESSION_FILE ${PATH_TO_PROJECT_ROOT}/cmake/scripts/ubsan.supp)
231230

232-
set_tests_properties(vdb_unit_test PROPERTIES
233-
ENVIRONMENT
234-
"$<$<CONFIG:UBSAN>:UBSAN_OPTIONS=halt_on_error=1 report_error_type=1 suppressions=${UBSAN_SUPRESSION_FILE}>")
231+
set(UBSAN_OPTS "$<$<CONFIG:UBSAN>:UBSAN_OPTIONS=halt_on_error=1 report_error_type=1 suppressions=${UBSAN_SUPRESSION_FILE}>")
232+
set(LSAN_OPTS "$<$<CONFIG:LSAN>:LSAN_OPTIONS=suppressions=${LSAN_SUPRESSION_FILE}>")
233+
set(ASAN_OPTS "$<$<CONFIG:ASAN>:LSAN_OPTIONS=suppressions=${LSAN_SUPRESSION_FILE}>")
235234

235+
set_tests_properties(vdb_unit_test PROPERTIES
236+
ENVIRONMENT "$<JOIN:${UBSAN_OPTS};${LSAN_OPTS};${ASAN_OPTS}, >")

openvdb_ax/openvdb_ax/test/CMakeLists.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,16 @@ endif()
133133

134134
add_test(NAME vdb_ax_unit_test COMMAND vdb_ax_test -v WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../)
135135

136-
# For the undefined behaviour sanitizer, add the suppression file and
137-
# additional options
138-
136+
# For the sanitizers, add the suppression files and additional options
139137
get_filename_component(PATH_TO_PROJECT_ROOT ${CMAKE_CURRENT_LIST_DIR} DIRECTORY)
140138
get_filename_component(PATH_TO_PROJECT_ROOT ${PATH_TO_PROJECT_ROOT} DIRECTORY)
141139
get_filename_component(PATH_TO_PROJECT_ROOT ${PATH_TO_PROJECT_ROOT} DIRECTORY)
140+
set(LSAN_SUPRESSION_FILE ${PATH_TO_PROJECT_ROOT}/cmake/scripts/lsan.supp)
142141
set(UBSAN_SUPRESSION_FILE ${PATH_TO_PROJECT_ROOT}/cmake/scripts/ubsan.supp)
143142

143+
set(UBSAN_OPTS "$<$<CONFIG:UBSAN>:UBSAN_OPTIONS=halt_on_error=1 report_error_type=1 suppressions=${UBSAN_SUPRESSION_FILE}>")
144+
set(LSAN_OPTS "$<$<CONFIG:LSAN>:LSAN_OPTIONS=suppressions=${LSAN_SUPRESSION_FILE}>")
145+
set(ASAN_OPTS "$<$<CONFIG:ASAN>:LSAN_OPTIONS=suppressions=${LSAN_SUPRESSION_FILE}>")
146+
144147
set_tests_properties(vdb_ax_unit_test PROPERTIES
145-
ENVIRONMENT
146-
"$<$<CONFIG:UBSAN>:UBSAN_OPTIONS=halt_on_error=1 report_error_type=1 suppressions=${UBSAN_SUPRESSION_FILE}>")
148+
ENVIRONMENT "$<JOIN:${UBSAN_OPTS};${LSAN_OPTS};${ASAN_OPTS}, >")

0 commit comments

Comments
 (0)