Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / asan_abi / CMakeLists.txt
blobf28cf6cd1da6eaa55788dd57d13abfd35d95a332
1 set(ASAN_ABI_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
2 set(ASAN_ABI_TESTSUITES)
4 macro(get_bits_for_arch arch bits)
5   if (${arch} MATCHES "arm64|x86_64")
6     set(${bits} 64)
7   else()
8     message(FATAL_ERROR "Unknown target architecture: ${arch}")
9   endif()
10 endmacro()
12 set(ASAN_ABI_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
13 if(NOT COMPILER_RT_STANDALONE_BUILD)
14   list(APPEND ASAN_ABI_TEST_DEPS asan_abi)
15 endif()
17 set(ASAN_ABI_TEST_ARCH ${ASAN_ABI_SUPPORTED_ARCH})
18 if(APPLE)
19   darwin_filter_host_archs(ASAN_ABI_SUPPORTED_ARCH ASAN_ABI_TEST_ARCH)
20 endif()
22 foreach(arch ${ASAN_ABI_TEST_ARCH})
23   set(ASAN_ABI_TEST_TARGET_ARCH ${arch})
24   set(ASAN_ABI_TEST_APPLE_PLATFORM "osx")
25   set(ASAN_ABI_TEST_MIN_DEPLOYMENT_TARGET_FLAG "${DARWIN_osx_MIN_VER_FLAG}")
26   string(TOLOWER "-${arch}-${OS_NAME}" ASAN_ABI_TEST_CONFIG_SUFFIX)
27   get_bits_for_arch(${arch} ASAN_ABI_TEST_BITS)
28   get_test_cc_for_arch(${arch} ASAN_ABI_TEST_TARGET_CC ASAN_ABI_TEST_TARGET_CFLAGS)
30   string(TOUPPER ${arch} ARCH_UPPER_CASE)
31   set(CONFIG_NAME ${ARCH_UPPER_CASE}${OS_NAME}Config)
33   list(APPEND ASAN_ABI_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
34   configure_lit_site_cfg(
35     ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
36     ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py
37     )
38 endforeach()
40 if(APPLE)
41   set(ASAN_ABI_TEST_TARGET_CC ${COMPILER_RT_TEST_COMPILER})
42   set(ASAN_ABI_TEST_APPLE_PLATFORMS ${SANITIZER_COMMON_SUPPORTED_OS})
44   foreach(platform ${ASAN_ABI_TEST_APPLE_PLATFORMS})
45     if ("${platform}" STREQUAL "osx")
46       # Skip macOS because it's handled by the code above that builds tests for the host machine.
47       continue()
48     endif()
49     list_intersect(
50       ASAN_ABI_TEST_${platform}_ARCHS
51       ASAN_ABI_SUPPORTED_ARCH
52       DARWIN_${platform}_ARCHS
53     )
54     foreach(arch ${ASAN_ABI_TEST_${platform}_ARCHS})
55       get_test_cflags_for_apple_platform(
56         "${platform}"
57         "${arch}"
58         ASAN_ABI_TEST_TARGET_CFLAGS
59         )
60       string(TOUPPER "${arch}" ARCH_UPPER_CASE)
61       get_capitalized_apple_platform("${platform}" PLATFORM_CAPITALIZED)
62       set(CONFIG_NAME "${PLATFORM_CAPITALIZED}${ARCH_UPPER_CASE}Config")
63       set(ASAN_ABI_TEST_CONFIG_SUFFIX "-${arch}-${platform}")
64       set(ASAN_ABI_TEST_APPLE_PLATFORM "${platform}")
65       set(ASAN_ABI_TEST_TARGET_ARCH "${arch}")
66       set(ASAN_ABI_TEST_MIN_DEPLOYMENT_TARGET_FLAG "${DARWIN_${platform}_MIN_VER_FLAG}")
67       get_bits_for_arch(${arch} ASAN_ABI_TEST_BITS)
68       configure_lit_site_cfg(
69         ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
70         ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py
71         )
72       add_lit_testsuite(check-asan-abi-${platform}-${arch} "AddressSanitizerABI ${platform} ${arch} tests"
73         ${ASAN_ABI_TESTSUITES}
74         EXCLUDE_FROM_CHECK_ALL
75         DEPENDS ${ASAN_ABI_TEST_DEPS})
76     endforeach()
77   endforeach()
78 endif()
80 add_lit_testsuite(check-asan-abi "Running the AddressSanitizerABI tests"
81   ${ASAN_ABI_TESTSUITES}
82   ${exclude_from_check_all}
83   DEPENDS ${ASAN_ABI_TEST_DEPS})
84 set_target_properties(check-asan-abi PROPERTIES FOLDER "Compiler-RT Misc")