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")
8 message(FATAL_ERROR "Unknown target architecture: ${arch}")
12 set(ASAN_ABI_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS} asan_abi)
14 set(ASAN_ABI_TEST_ARCH ${ASAN_ABI_SUPPORTED_ARCH})
16 darwin_filter_host_archs(ASAN_ABI_SUPPORTED_ARCH ASAN_ABI_TEST_ARCH)
19 foreach(arch ${ASAN_ABI_TEST_ARCH})
20 set(ASAN_ABI_TEST_TARGET_ARCH ${arch})
21 set(ASAN_ABI_TEST_APPLE_PLATFORM "osx")
22 set(ASAN_ABI_TEST_MIN_DEPLOYMENT_TARGET_FLAG "${DARWIN_osx_MIN_VER_FLAG}")
23 string(TOLOWER "-${arch}-${OS_NAME}" ASAN_ABI_TEST_CONFIG_SUFFIX)
24 get_bits_for_arch(${arch} ASAN_ABI_TEST_BITS)
25 get_test_cc_for_arch(${arch} ASAN_ABI_TEST_TARGET_CC ASAN_ABI_TEST_TARGET_CFLAGS)
27 string(TOUPPER ${arch} ARCH_UPPER_CASE)
28 set(CONFIG_NAME ${ARCH_UPPER_CASE}${OS_NAME}Config)
30 list(APPEND ASAN_ABI_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
31 configure_lit_site_cfg(
32 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
33 ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py
38 set(ASAN_ABI_TEST_TARGET_CC ${COMPILER_RT_TEST_COMPILER})
39 set(ASAN_ABI_TEST_APPLE_PLATFORMS ${SANITIZER_COMMON_SUPPORTED_OS})
41 foreach(platform ${ASAN_ABI_TEST_APPLE_PLATFORMS})
42 if ("${platform}" STREQUAL "osx")
43 # Skip macOS because it's handled by the code above that builds tests for the host machine.
47 ASAN_ABI_TEST_${platform}_ARCHS
48 ASAN_ABI_SUPPORTED_ARCH
49 DARWIN_${platform}_ARCHS
51 foreach(arch ${ASAN_ABI_TEST_${platform}_ARCHS})
52 get_test_cflags_for_apple_platform(
55 ASAN_ABI_TEST_TARGET_CFLAGS
57 string(TOUPPER "${arch}" ARCH_UPPER_CASE)
58 get_capitalized_apple_platform("${platform}" PLATFORM_CAPITALIZED)
59 set(CONFIG_NAME "${PLATFORM_CAPITALIZED}${ARCH_UPPER_CASE}Config")
60 set(ASAN_ABI_TEST_CONFIG_SUFFIX "-${arch}-${platform}")
61 set(ASAN_ABI_TEST_APPLE_PLATFORM "${platform}")
62 set(ASAN_ABI_TEST_TARGET_ARCH "${arch}")
63 set(ASAN_ABI_TEST_MIN_DEPLOYMENT_TARGET_FLAG "${DARWIN_${platform}_MIN_VER_FLAG}")
64 get_bits_for_arch(${arch} ASAN_ABI_TEST_BITS)
65 configure_lit_site_cfg(
66 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
67 ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py
69 add_lit_testsuite(check-asan-abi-${platform}-${arch} "AddressSanitizerABI ${platform} ${arch} tests"
70 ${ASAN_ABI_TESTSUITES}
71 EXCLUDE_FROM_CHECK_ALL
72 DEPENDS ${ASAN_ABI_TEST_DEPS})
77 add_lit_testsuite(check-asan-abi "Running the AddressSanitizerABI tests"
78 ${ASAN_ABI_TESTSUITES}
79 ${exclude_from_check_all}
80 DEPENDS ${ASAN_ABI_TEST_DEPS})