1 set(LSAN_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
5 set(LSAN_TEST_ARCH ${LSAN_SUPPORTED_ARCH})
7 darwin_filter_host_archs(LSAN_SUPPORTED_ARCH LSAN_TEST_ARCH)
10 foreach(arch ${LSAN_TEST_ARCH})
11 set(LSAN_TEST_TARGET_ARCH ${arch})
12 string(TOLOWER "-${arch}" LSAN_TEST_CONFIG_SUFFIX)
13 get_test_cc_for_arch(${arch} LSAN_TEST_TARGET_CC LSAN_TEST_TARGET_CFLAGS)
14 string(TOUPPER ${arch} ARCH_UPPER_CASE)
16 set(LSAN_LIT_TEST_MODE "Standalone")
17 set(CONFIG_NAME ${ARCH_UPPER_CASE}LsanConfig)
18 configure_lit_site_cfg(
19 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
20 ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py)
21 list(APPEND LSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
23 list(FIND ASAN_SUPPORTED_ARCH ${arch} _found)
24 if(NOT _found EQUAL -1 AND COMPILER_RT_HAS_ASAN)
25 set(CONFIG_NAME ${ARCH_UPPER_CASE}AsanConfig)
26 set(LSAN_LIT_TEST_MODE "AddressSanitizer")
27 configure_lit_site_cfg(
28 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
29 ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py)
30 list(APPEND LSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
33 list(FIND HWASAN_SUPPORTED_ARCH ${arch} _found)
34 if(NOT _found EQUAL -1 AND COMPILER_RT_HAS_HWASAN)
35 set(CONFIG_NAME ${ARCH_UPPER_CASE}HWAsanConfig)
36 set(LSAN_LIT_TEST_MODE "HWAddressSanitizer")
37 configure_lit_site_cfg(
38 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
39 ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py)
40 list(APPEND LSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
44 set(LSAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
45 list(APPEND LSAN_TEST_DEPS lsan)
46 append_list_if(COMPILER_RT_HAS_ASAN asan LSAN_TEST_DEPS)
47 append_list_if(COMPILER_RT_HAS_HWASAN hwasan LSAN_TEST_DEPS)
48 add_lit_testsuite(check-lsan "Running the LeakSanitizer tests"
50 DEPENDS ${LSAN_TEST_DEPS})
51 set_target_properties(check-lsan PROPERTIES FOLDER "Compiler-RT Misc")