@@ -82,56 +82,43 @@ endforeach()
82
82
# variable to select which iOS device or simulator to use, e.g.:
83
83
# SANITIZER_IOSSIM_TEST_DEVICE_IDENTIFIER="iPhone 6"
84
84
if (APPLE )
85
- # FIXME(dliew): This logic should be refactored to the way UBSan Darwin
86
- # testing is done.
87
85
set (EXCLUDE_FROM_ALL ON )
88
-
89
86
set (ASAN_TEST_TARGET_CC ${COMPILER_RT_TEST_COMPILER} )
90
87
set (ASAN_TEST_DYNAMIC True )
88
+ set (ASAN_APPLE_PLATFORMS ${SANITIZER_COMMON_SUPPORTED_OS} )
91
89
92
- list_intersect (ASAN_TEST_IOSSIM_ARCHS ASAN_SUPPORTED_ARCH DARWIN_iossim_ARCHS )
93
- foreach (arch ${ASAN_TEST_IOSSIM_ARCHS} )
94
- set (ASAN_TEST_APPLE_PLATFORM "iossim" )
95
- set (ASAN_TEST_TARGET_ARCH ${arch} )
96
- get_test_cflags_for_apple_platform (
97
- "${ASAN_TEST_APPLE_PLATFORM} "
98
- "${ASAN_TEST_TARGET_ARCH} "
99
- ASAN_TEST_TARGET_CFLAGS
100
- )
101
- set (ASAN_TEST_CONFIG_SUFFIX "-${arch} -${ASAN_TEST_APPLE_PLATFORM} " )
102
- get_bits_for_arch (${arch} ASAN_TEST_BITS )
103
- string (TOUPPER ${arch} ARCH_UPPER_CASE )
104
- set (CONFIG_NAME "IOSSim${ARCH_UPPER_CASE} Config" )
105
- configure_lit_site_cfg (
106
- ${CMAKE_CURRENT_SOURCE_DIR} /lit.site.cfg.py.in
107
- ${CMAKE_CURRENT_BINARY_DIR} /${CONFIG_NAME}/lit.site.cfg.py
108
- )
109
- add_lit_testsuite (check-asan-iossim-${arch} "AddressSanitizer iOS Simulator ${arch} tests"
110
- ${CMAKE_CURRENT_BINARY_DIR} /${CONFIG_NAME}/
111
- DEPENDS ${ASAN_TEST_DEPS} )
112
- endforeach ()
113
-
114
- list_intersect (ASAN_TEST_IOS_ARCHS ASAN_SUPPORTED_ARCH DARWIN_ios_ARCHS )
115
- foreach (arch ${ASAN_TEST_IOS_ARCHS} )
116
- set (ASAN_TEST_APPLE_PLATFORM "ios" )
117
- set (ASAN_TEST_TARGET_ARCH ${arch} )
118
- get_test_cflags_for_apple_platform (
119
- "${ASAN_TEST_APPLE_PLATFORM} "
120
- "${arch} "
121
- ASAN_TEST_TARGET_CFLAGS )
122
- set (ASAN_TEST_CONFIG_SUFFIX "-${arch} -${ASAN_TEST_APPLE_PLATFORM} " )
123
- get_bits_for_arch (${arch} ASAN_TEST_BITS )
124
- string (TOUPPER ${arch} ARCH_UPPER_CASE )
125
- set (CONFIG_NAME "IOS${ARCH_UPPER_CASE} Config" )
126
- configure_lit_site_cfg (
127
- ${CMAKE_CURRENT_SOURCE_DIR} /lit.site.cfg.py.in
128
- ${CMAKE_CURRENT_BINARY_DIR} /${CONFIG_NAME}/lit.site.cfg.py
129
- )
130
- add_lit_testsuite (check-asan-ios-${arch} "AddressSanitizer iOS ${arch} tests"
131
- ${CMAKE_CURRENT_BINARY_DIR} /${CONFIG_NAME}/
132
- DEPENDS ${ASAN_TEST_DEPS} )
90
+ foreach (platform ${ASAN_APPLE_PLATFORMS} )
91
+ if ("${platform} " STREQUAL "osx" )
92
+ # Skip macOS because it's handled by the code above that builds tests for the host machine.
93
+ continue ()
94
+ endif ()
95
+ list_intersect (
96
+ ASAN_TEST_${platform}_ARCHS
97
+ ASAN_SUPPORTED_ARCH
98
+ DARWIN_${platform}_ARCHS
99
+ )
100
+ foreach (arch ${ASAN_TEST_${platform}_ARCHS} )
101
+ get_test_cflags_for_apple_platform (
102
+ "${platform} "
103
+ "${arch} "
104
+ ASAN_TEST_TARGET_CFLAGS
105
+ )
106
+ string (TOUPPER "${arch} " ARCH_UPPER_CASE )
107
+ get_capitalized_apple_platform ("${platform} " PLATFORM_CAPITALIZED )
108
+ set (CONFIG_NAME "${PLATFORM_CAPITALIZED}${ARCH_UPPER_CASE} Config" )
109
+ set (ASAN_TEST_CONFIG_SUFFIX "-${arch} -${platform} " )
110
+ set (ASAN_TEST_APPLE_PLATFORM "${platform} " )
111
+ set (ASAN_TEST_TARGET_ARCH "${arch} " )
112
+ get_bits_for_arch (${arch} ASAN_TEST_BITS )
113
+ configure_lit_site_cfg (
114
+ ${CMAKE_CURRENT_SOURCE_DIR} /lit.site.cfg.py.in
115
+ ${CMAKE_CURRENT_BINARY_DIR} /${CONFIG_NAME}/lit.site.cfg.py
116
+ )
117
+ add_lit_testsuite (check-asan-${platform}-${arch} "AddressSanitizer ${platform} ${arch} tests"
118
+ ${CMAKE_CURRENT_BINARY_DIR} /${CONFIG_NAME}/
119
+ DEPENDS ${ASAN_TEST_DEPS} )
120
+ endforeach ()
133
121
endforeach ()
134
-
135
122
set (EXCLUDE_FROM_ALL OFF )
136
123
endif ()
137
124
0 commit comments