From f23ee504d04bcb381fc05f0feeb90bc36fe8faa3 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 9 Jan 2024 12:22:38 +0100 Subject: [PATCH] Tests: Improve the sanitizer options handling. Previous code was using the 'nuclear' SAN weapon `exitcode=0`, which essentially makes testing ignore all sanitizer errors. This commit removes this option, and instead uses the suppression list from Blender source repository (`tools/config/analysis/lsan.supp`) for the leak sanitizer. It also enables the `allocator_may_return_null` for the address sanitizer. This should only be needed for one test (the `guardedalloc` one), but for now it is simpler to define it for all tests. This can be refined at a later time. Pull Request: https://projects.blender.org/blender/blender/pulls/116635 --- build_files/cmake/testing.cmake | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/build_files/cmake/testing.cmake b/build_files/cmake/testing.cmake index a67b30dee0b..7e888425b4a 100644 --- a/build_files/cmake/testing.cmake +++ b/build_files/cmake/testing.cmake @@ -26,14 +26,9 @@ function(blender_test_set_envvars testname envvars_list) if(NOT CMAKE_BUILD_TYPE MATCHES "Release") if(WITH_COMPILER_ASAN) - # Don't fail tests on leaks since these often happen in external libraries that we can't fix. - # FIXME This is a 'nuke solution', no xSAN errors will ever fail tests. Needs more refined handling, - # see https://projects.blender.org/blender/blender/pulls/116635 . - set(_lsan_options "LSAN_OPTIONS=exitcode=0") + set(_lsan_options "LSAN_OPTIONS=print_suppressions=false:suppressions=${CMAKE_SOURCE_DIR}/tools/config/analysis/lsan.supp") # FIXME That `allocator_may_return_null=true` ASAN option is only needed for the `guardedalloc` test, # would be nice to allow tests definition to pass extra envvars better. - # NOTE: This is needed for Mac builds currently, on Linux the `exitcode=0` option passed above to LSAN - # also seems to silence reports from ASAN. set(_asan_options "ASAN_OPTIONS=allocator_may_return_null=true") if(DEFINED ENV{LSAN_OPTIONS}) set(_lsan_options "${_lsan_options}:$ENV{LSAN_OPTIONS}")