diff --git a/compiler-rt/test/asan/CMakeLists.txt b/compiler-rt/test/asan/CMakeLists.txt --- a/compiler-rt/test/asan/CMakeLists.txt +++ b/compiler-rt/test/asan/CMakeLists.txt @@ -82,56 +82,41 @@ # variable to select which iOS device or simulator to use, e.g.: # SANITIZER_IOSSIM_TEST_DEVICE_IDENTIFIER="iPhone 6" if(APPLE) - # FIXME(dliew): This logic should be refactored to the way UBSan Darwin - # testing is done. set(EXCLUDE_FROM_ALL ON) - set(ASAN_TEST_TARGET_CC ${COMPILER_RT_TEST_COMPILER}) set(ASAN_TEST_DYNAMIC True) + set(ASAN_APPLE_PLATFORMS ${SANITIZER_COMMON_SUPPORTED_OS}) - list_intersect(ASAN_TEST_IOSSIM_ARCHS ASAN_SUPPORTED_ARCH DARWIN_iossim_ARCHS) - foreach(arch ${ASAN_TEST_IOSSIM_ARCHS}) - set(ASAN_TEST_APPLE_PLATFORM "iossim") - set(ASAN_TEST_TARGET_ARCH ${arch}) - get_test_cflags_for_apple_platform( - "${ASAN_TEST_APPLE_PLATFORM}" - "${ASAN_TEST_TARGET_ARCH}" - ASAN_TEST_TARGET_CFLAGS - ) - set(ASAN_TEST_CONFIG_SUFFIX "-${arch}-${ASAN_TEST_APPLE_PLATFORM}") - get_bits_for_arch(${arch} ASAN_TEST_BITS) - string(TOUPPER ${arch} ARCH_UPPER_CASE) - set(CONFIG_NAME "IOSSim${ARCH_UPPER_CASE}Config") - configure_lit_site_cfg( - ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in - ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py - ) - add_lit_testsuite(check-asan-iossim-${arch} "AddressSanitizer iOS Simulator ${arch} tests" - ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/ - DEPENDS ${ASAN_TEST_DEPS}) - endforeach() - - list_intersect(ASAN_TEST_IOS_ARCHS ASAN_SUPPORTED_ARCH DARWIN_ios_ARCHS) - foreach (arch ${ASAN_TEST_IOS_ARCHS}) - set(ASAN_TEST_APPLE_PLATFORM "ios") - set(ASAN_TEST_TARGET_ARCH ${arch}) - get_test_cflags_for_apple_platform( - "${ASAN_TEST_APPLE_PLATFORM}" - "${arch}" - ASAN_TEST_TARGET_CFLAGS) - set(ASAN_TEST_CONFIG_SUFFIX "-${arch}-${ASAN_TEST_APPLE_PLATFORM}") - get_bits_for_arch(${arch} ASAN_TEST_BITS) - string(TOUPPER ${arch} ARCH_UPPER_CASE) - set(CONFIG_NAME "IOS${ARCH_UPPER_CASE}Config") - configure_lit_site_cfg( - ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in - ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py - ) - add_lit_testsuite(check-asan-ios-${arch} "AddressSanitizer iOS ${arch} tests" - ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/ - DEPENDS ${ASAN_TEST_DEPS}) + foreach(platform ${ASAN_APPLE_PLATFORMS}) + if ("${platform}" STREQUAL "osx") + # Skip macOS because it's handled by the code above that builds tests for the host machine. + continue() + endif() + list_intersect( + ASAN_TEST_${platform}_ARCHS + ASAN_SUPPORTED_ARCH + DARWIN_${platform}_ARCHS + ) + foreach(arch ${ASAN_TEST_${platform}_ARCHS}) + get_test_cflags_for_apple_platform( + "${platform}" + "${arch}" + ASAN_TEST_TARGET_CFLAGS + ) + set(CONFIG_NAME "${platform}-${arch}") + set(ASAN_TEST_CONFIG_SUFFIX "-${CONFIG_NAME}") + set(ASAN_TEST_APPLE_PLATFORM "${platform}") + set(ASAN_TEST_TARGET_ARCH "${arch}") + get_bits_for_arch(${arch} ASAN_TEST_BITS) + configure_lit_site_cfg( + ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in + ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py + ) + add_lit_testsuite(check-asan-${platform}-${arch} "AddressSanitizer ${platform} ${arch} tests" + ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/ + DEPENDS ${ASAN_TEST_DEPS}) + endforeach() endforeach() - set(EXCLUDE_FROM_ALL OFF) endif()