]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: factor the ASan/LSan test options into cache variables
authorKefu Chai <k.chai@proxmox.com>
Tue, 23 Jun 2026 08:14:19 +0000 (16:14 +0800)
committerKefu Chai <k.chai@proxmox.com>
Tue, 23 Jun 2026 15:02:05 +0000 (23:02 +0800)
add_ceph_test() spelled out the suppression-file paths and sanitizer flags
inline.  bin/ceph needs the same options, so lift them into CEPH_ASAN_OPTIONS
and CEPH_LSAN_OPTIONS and have add_ceph_test() consume those.  The environment
the tests run with is unchanged.

Signed-off-by: Kefu Chai <k.chai@proxmox.com>
CMakeLists.txt
cmake/modules/AddCephTest.cmake

index f2abb516b65d46ee986f0054df293db8b80368bf..0fcdf9664bc9177fb2590ae60a7ef6c901f855f3 100644 (file)
@@ -724,6 +724,13 @@ endif(LINUX)
 option(WITH_ASAN "build with ASAN" OFF)
 if(WITH_ASAN)
   list(APPEND sanitizers "address")
+  # Shared ASan/LSan runtime options: the in-tree suppression files plus the
+  # flags our tests need.  Consumed by add_ceph_test() and baked into bin/ceph
+  # so both ignore the same still-reachable third-party leaks.
+  set(CEPH_ASAN_OPTIONS "suppressions=${CMAKE_SOURCE_DIR}/qa/asan.supp,detect_odr_violation=0"
+      CACHE INTERNAL "ASAN_OPTIONS for ceph tests and the ceph CLI")
+  set(CEPH_LSAN_OPTIONS "suppressions=${CMAKE_SOURCE_DIR}/qa/lsan.supp,print_suppressions=0"
+      CACHE INTERNAL "LSAN_OPTIONS for ceph tests and the ceph CLI")
 endif()
 
 option(WITH_ASAN_LEAK "explicitly enable ASAN leak detection" OFF)
index 49562e569b09003c5bc12de38318d2d3c0415941..a96ea2231af4d9f18881fb87f56d05cf7744a848 100644 (file)
@@ -33,8 +33,8 @@ function(add_ceph_test test_name test_path)
     set_property(TEST ${test_name}
       APPEND
       PROPERTY ENVIRONMENT
-      ASAN_OPTIONS=suppressions=${CMAKE_SOURCE_DIR}/qa/asan.supp,detect_odr_violation=0
-      LSAN_OPTIONS=suppressions=${CMAKE_SOURCE_DIR}/qa/lsan.supp,print_suppressions=0)
+      ASAN_OPTIONS=${CEPH_ASAN_OPTIONS}
+      LSAN_OPTIONS=${CEPH_LSAN_OPTIONS})
   endif()
   set_property(TEST ${test_name}
     PROPERTY TIMEOUT ${CEPH_TEST_TIMEOUT})