Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / msan / CMakeLists.txt
blob01b832b5ae3f9d0692dc83090af11e6924ced299
1 set(MSAN_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
3 set(MSAN_TESTSUITES)
4 set(MSAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
6 set(MSAN_TEST_ARCH ${MSAN_SUPPORTED_ARCH})
7 if(APPLE)
8   darwin_filter_host_archs(MSAN_SUPPORTED_ARCH MSAN_TEST_ARCH)
9 endif()
11 macro(add_msan_testsuite arch lld thinlto)
12   set(MSAN_TEST_TARGET_ARCH ${arch})
13   get_test_cc_for_arch(${arch} MSAN_TEST_TARGET_CC MSAN_TEST_TARGET_CFLAGS)
15   string(TOUPPER ${arch} CONFIG_NAME)
17   if (${thinlto})
18     set(CONFIG_NAME "thinlto-${CONFIG_NAME}")
19     list(APPEND MSAN_TEST_DEPS LTO)
20   endif()
21   if (${lld})
22     set(CONFIG_NAME "lld-${CONFIG_NAME}")
23     if (TARGET lld)
24       list(APPEND MSAN_TEST_DEPS lld)
25     endif()
26   endif()
27   set(MSAN_TEST_USE_THINLTO ${thinlto})
28   set(MSAN_TEST_USE_LLD ${lld})
30   configure_lit_site_cfg(
31     ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
32     ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py)
33   list(APPEND MSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
34 endmacro()
36 foreach(arch ${MSAN_TEST_ARCH})
37   add_msan_testsuite(${arch} False False)
39   if(COMPILER_RT_HAS_LLD AND arch STREQUAL "x86_64" AND NOT (APPLE OR WIN32))
40     add_msan_testsuite(${arch} True False)
41   endif()
42 endforeach()
44 if(NOT COMPILER_RT_STANDALONE_BUILD)
45   list(APPEND MSAN_TEST_DEPS msan)
46 endif()
48 if(COMPILER_RT_INCLUDE_TESTS AND
49    COMPILER_RT_LIBCXX_PATH AND
50    COMPILER_RT_LIBCXXABI_PATH)
51   configure_lit_site_cfg(
52     ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
53     ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py)
54   list(APPEND MSAN_TEST_DEPS MsanUnitTests)
55   list(APPEND MSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/Unit)
56 endif()
58 add_lit_testsuite(check-msan "Running the MemorySanitizer tests"
59   ${MSAN_TESTSUITES}
60   DEPENDS ${MSAN_TEST_DEPS}
61   )
62 set_target_properties(check-msan PROPERTIES FOLDER "Compiler-RT Misc")