]> git.proxmox.com Git - rustc.git/blob - src/compiler-rt/test/msan/CMakeLists.txt
New upstream version 1.12.0+dfsg1
[rustc.git] / src / compiler-rt / test / msan / CMakeLists.txt
1 set(MSAN_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
2
3 set(MSAN_TESTSUITES)
4
5 set(MSAN_TEST_ARCH ${MSAN_SUPPORTED_ARCH})
6 if(APPLE)
7 darwin_filter_host_archs(MSAN_SUPPORTED_ARCH MSAN_TEST_ARCH)
8 endif()
9
10 foreach(arch ${MSAN_TEST_ARCH})
11 set(MSAN_TEST_TARGET_ARCH ${arch})
12 string(TOLOWER "-${arch}" MSAN_TEST_CONFIG_SUFFIX)
13 if(ANDROID OR ${arch} MATCHES "arm|aarch64")
14 # This is only true if we are cross-compiling.
15 # Build all tests with host compiler and use host tools.
16 set(MSAN_TEST_TARGET_CC ${COMPILER_RT_TEST_COMPILER})
17 set(MSAN_TEST_TARGET_CFLAGS ${COMPILER_RT_TEST_COMPILER_CFLAGS})
18 else()
19 get_target_flags_for_arch(${arch} MSAN_TEST_TARGET_CFLAGS)
20 string(REPLACE ";" " " MSAN_TEST_TARGET_CFLAGS "${MSAN_TEST_TARGET_CFLAGS}")
21 endif()
22
23 string(TOUPPER ${arch} ARCH_UPPER_CASE)
24 set(CONFIG_NAME ${ARCH_UPPER_CASE}Config)
25
26 configure_lit_site_cfg(
27 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
28 ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg)
29 list(APPEND MSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
30 endforeach()
31
32 set(MSAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
33 if(NOT COMPILER_RT_STANDALONE_BUILD)
34 list(APPEND MSAN_TEST_DEPS msan)
35 endif()
36
37 if(COMPILER_RT_INCLUDE_TESTS AND COMPILER_RT_HAS_LIBCXX_SOURCES)
38 configure_lit_site_cfg(
39 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
40 ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg)
41 list(APPEND MSAN_TEST_DEPS MsanUnitTests)
42 list(APPEND MSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/Unit)
43 endif()
44
45 add_lit_testsuite(check-msan "Running the MemorySanitizer tests"
46 ${MSAN_TESTSUITES}
47 DEPENDS ${MSAN_TEST_DEPS}
48 )
49 set_target_properties(check-msan PROPERTIES FOLDER "Compiler-RT Misc")