1set(MSAN_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) 2 3set(MSAN_TESTSUITES) 4set(MSAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS}) 5 6set(MSAN_TEST_ARCH ${MSAN_SUPPORTED_ARCH}) 7if(APPLE) 8 darwin_filter_host_archs(MSAN_SUPPORTED_ARCH MSAN_TEST_ARCH) 9endif() 10 11macro(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) 14 15 string(TOUPPER ${arch} CONFIG_NAME) 16 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}) 29 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}) 34endmacro() 35 36foreach(arch ${MSAN_TEST_ARCH}) 37 add_msan_testsuite(${arch} False False) 38 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() 42endforeach() 43 44if(NOT COMPILER_RT_STANDALONE_BUILD) 45 list(APPEND MSAN_TEST_DEPS msan) 46endif() 47 48if(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) 56endif() 57 58add_lit_testsuite(check-msan "Running the MemorySanitizer tests" 59 ${MSAN_TESTSUITES} 60 DEPENDS ${MSAN_TEST_DEPS} 61 ) 62set_target_properties(check-msan PROPERTIES FOLDER "Compiler-RT Misc") 63