cmake: Disable deepbind if we run with sanitizers
authorAndreas Schneider <asn@cryptomilk.org>
Sat, 14 Jan 2023 08:30:17 +0000 (09:30 +0100)
committerAndreas Schneider <asn@samba.org>
Tue, 17 Jan 2023 13:31:10 +0000 (14:31 +0100)
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
tests/CMakeLists.txt

index da804eb2fdeef738ec0d640de6f3ebe377d20a59..635e86e17a017d1cb306b3707ff8778a264dddc4 100644 (file)
@@ -40,6 +40,15 @@ function(ADD_CMOCKA_TEST_ENVIRONMENT _TEST_NAME)
 
     list(APPEND TORTURE_ENVIRONMENT UID_WRAPPER=1)
 
+    if (CMAKE_BUILD_TYPE)
+        string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
+        if (CMAKE_BUILD_TYPE_LOWER STREQUAL "addresssanitizer" OR
+            CMAKE_BUILD_TYPE_LOWER STREQUAL "threadsanitizer" OR
+            CMAKE_BUILD_TYPE_LOWER STREQUAL "undefinedsanitizer")
+            list(APPEND TORTURE_ENVIRONMENT "UID_WRAPPER_DISABLE_DEEPBIND=1")
+        endif()
+    endif()
+
     foreach(_arg ${ARGN})
         list(APPEND TORTURE_ENVIRONMENT ${_arg})
     endforeach()