1set(MSAN_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) 2 3set(MSAN_TESTSUITES) 4set(MSAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS} msan) 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(COMPILER_RT_LIBCXX_PATH AND COMPILER_RT_LIBCXXABI_PATH) 45 configure_lit_site_cfg( 46 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in 47 ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py) 48 list(APPEND MSAN_TEST_DEPS MsanUnitTests) 49 list(APPEND MSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/Unit) 50endif() 51 52add_lit_testsuite(check-msan "Running the MemorySanitizer tests" 53 ${MSAN_TESTSUITES} 54 DEPENDS ${MSAN_TEST_DEPS} 55 ) 56