[PATCH] D73232: [CMake] Refactor iOS simulator/device test configuration generation code for ASan.
Dan Liew via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 22 14:31:38 PST 2020
delcypher created this revision.
delcypher added reviewers: kubamracek, yln.
Herald added subscribers: Sanitizers, mgorny.
Herald added projects: Sanitizers, LLVM.
The previous code hard-coded platform names but compiler-rt's CMake
build system actually already knows which Apple platforms ASan supports.
This change deliberately changes two things:
- Lit config directory name. This is now just uses compiler-rt's
internal platform and architecture name rather than doing pointless
capitalization and appending `Config`. E.g. `IOSSimX86_64Config` is now
`iossim-x86_64`. The ordering of platform and architecture now also
matches the build system target name (e.g. `ninja check-asan-iossim-x86_64`)
- Lit test suite prefix. This also been changed to be consistent with the build system target name. E.g. `-x86_64-iossim` is now `-iossim-x86_64`.
Changing these two aspects should have minimal impact because developers
should be using the target name and not relying on the lit config name
or test suite prefix.
rdar://problem/58798733
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D73232
Files:
compiler-rt/test/asan/CMakeLists.txt
Index: compiler-rt/test/asan/CMakeLists.txt
===================================================================
--- compiler-rt/test/asan/CMakeLists.txt
+++ 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()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73232.239704.patch
Type: text/x-patch
Size: 3621 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200122/a99f0dec/attachment.bin>
More information about the llvm-commits
mailing list