Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / lsan / CMakeLists.txt
blobe487f1a862c81d50b526adf88be8cbcf8745c645
1 set(LSAN_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
3 set(LSAN_TESTSUITES)
5 set(LSAN_TEST_ARCH ${LSAN_SUPPORTED_ARCH})
6 if(APPLE)
7   darwin_filter_host_archs(LSAN_SUPPORTED_ARCH LSAN_TEST_ARCH)
8 endif()
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})
31   endif()
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})
41   endif()
42 endforeach()
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"
49   ${LSAN_TESTSUITES}
50   DEPENDS ${LSAN_TEST_DEPS})
51 set_target_properties(check-lsan PROPERTIES FOLDER "Compiler-RT Misc")