forked from OSchip/llvm-project
[sanitizer] Add macOS minimum deployment target to all compiler invocations in lit tests
The Clang driver on macOS decides the deployment target based on various things, like your host OS version, the SDK version and some environment variables, which makes lit tests pass or fail based on your environment. Let's make sure we run all lit tests with `-mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION}` (10.9 unless overriden). Differential Revision: https://reviews.llvm.org/D26929 llvm-svn: 288186
This commit is contained in:
parent
f96eeec005
commit
ff1bd20ded
|
@ -128,6 +128,24 @@ function(get_target_flags_for_arch arch out_var)
|
|||
endif()
|
||||
endfunction()
|
||||
|
||||
# Returns a compiler and CFLAGS that should be used to run tests for the
|
||||
# specific architecture. When cross-compiling, this is controled via
|
||||
# COMPILER_RT_TEST_COMPILER and COMPILER_RT_TEST_COMPILER_CFLAGS.
|
||||
macro(get_test_cc_for_arch arch cc_out cflags_out)
|
||||
if(ANDROID OR ${arch} MATCHES "arm|aarch64")
|
||||
# This is only true if we are cross-compiling.
|
||||
# Build all tests with host compiler and use host tools.
|
||||
set(${cc_out} ${COMPILER_RT_TEST_COMPILER})
|
||||
set(${cflags_out} ${COMPILER_RT_TEST_COMPILER_CFLAGS})
|
||||
else()
|
||||
get_target_flags_for_arch(${arch} ${cflags_out})
|
||||
if(APPLE)
|
||||
list(APPEND ${cflags_out} ${DARWIN_osx_CFLAGS})
|
||||
endif()
|
||||
string(REPLACE ";" " " ${cflags_out} "${${cflags_out}}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
set(ARM64 aarch64)
|
||||
set(ARM32 arm armhf)
|
||||
set(X86 i386 i686)
|
||||
|
|
|
@ -43,15 +43,7 @@ foreach(arch ${ASAN_TEST_ARCH})
|
|||
endif()
|
||||
string(TOLOWER "-${arch}-${OS_NAME}" ASAN_TEST_CONFIG_SUFFIX)
|
||||
get_bits_for_arch(${arch} ASAN_TEST_BITS)
|
||||
if(ANDROID OR ${arch} MATCHES "arm|aarch64")
|
||||
# This is only true if we are cross-compiling.
|
||||
# Build all tests with host compiler and use host tools.
|
||||
set(ASAN_TEST_TARGET_CC ${COMPILER_RT_TEST_COMPILER})
|
||||
set(ASAN_TEST_TARGET_CFLAGS ${COMPILER_RT_TEST_COMPILER_CFLAGS})
|
||||
else()
|
||||
get_target_flags_for_arch(${arch} ASAN_TEST_TARGET_CFLAGS)
|
||||
string(REPLACE ";" " " ASAN_TEST_TARGET_CFLAGS "${ASAN_TEST_TARGET_CFLAGS}")
|
||||
endif()
|
||||
get_test_cc_for_arch(${arch} ASAN_TEST_TARGET_CC ASAN_TEST_TARGET_CFLAGS)
|
||||
if(ANDROID)
|
||||
set(ASAN_TEST_DYNAMIC True)
|
||||
else()
|
||||
|
|
|
@ -10,16 +10,7 @@ endif()
|
|||
foreach(arch ${DFSAN_TEST_ARCH})
|
||||
set(DFSAN_TEST_TARGET_ARCH ${arch})
|
||||
string(TOLOWER "-${arch}" DFSAN_TEST_CONFIG_SUFFIX)
|
||||
if(ANDROID OR ${arch} MATCHES "arm|aarch64")
|
||||
# This is only true if we are cross-compiling.
|
||||
# Build all tests with host compiler and use host tools.
|
||||
set(DFSAN_TEST_TARGET_CC ${COMPILER_RT_TEST_COMPILER})
|
||||
set(DFSAN_TEST_TARGET_CFLAGS ${COMPILER_RT_TEST_COMPILER_CFLAGS})
|
||||
else()
|
||||
get_target_flags_for_arch(${arch} DFSAN_TEST_TARGET_CFLAGS)
|
||||
string(REPLACE ";" " " DFSAN_TEST_TARGET_CFLAGS "${DFSAN_TEST_TARGET_CFLAGS}")
|
||||
endif()
|
||||
|
||||
get_test_cc_for_arch(${arch} DFSAN_TEST_TARGET_CC DFSAN_TEST_TARGET_CFLAGS)
|
||||
string(TOUPPER ${arch} ARCH_UPPER_CASE)
|
||||
set(CONFIG_NAME ${ARCH_UPPER_CASE}Config)
|
||||
|
||||
|
|
|
@ -10,16 +10,7 @@ endif()
|
|||
foreach(arch ${LSAN_TEST_ARCH})
|
||||
set(LSAN_TEST_TARGET_ARCH ${arch})
|
||||
string(TOLOWER "-${arch}" LSAN_TEST_CONFIG_SUFFIX)
|
||||
if(ANDROID OR ${arch} MATCHES "arm|aarch64")
|
||||
# This is only true if we are cross-compiling.
|
||||
# Build all tests with host compiler and use host tools.
|
||||
set(LSAN_TEST_TARGET_CC ${COMPILER_RT_TEST_COMPILER})
|
||||
set(LSAN_TEST_TARGET_CFLAGS ${COMPILER_RT_TEST_COMPILER_CFLAGS})
|
||||
else()
|
||||
get_target_flags_for_arch(${arch} LSAN_TEST_TARGET_CFLAGS)
|
||||
string(REPLACE ";" " " LSAN_TEST_TARGET_CFLAGS "${LSAN_TEST_TARGET_CFLAGS}")
|
||||
endif()
|
||||
|
||||
get_test_cc_for_arch(${arch} LSAN_TEST_TARGET_CC LSAN_TEST_TARGET_CFLAGS)
|
||||
string(TOUPPER ${arch} ARCH_UPPER_CASE)
|
||||
set(LSAN_LIT_TEST_MODE "Standalone")
|
||||
set(CONFIG_NAME ${ARCH_UPPER_CASE}LsanConfig)
|
||||
|
|
|
@ -10,16 +10,7 @@ endif()
|
|||
foreach(arch ${MSAN_TEST_ARCH})
|
||||
set(MSAN_TEST_TARGET_ARCH ${arch})
|
||||
string(TOLOWER "-${arch}" MSAN_TEST_CONFIG_SUFFIX)
|
||||
if(ANDROID OR ${arch} MATCHES "arm|aarch64")
|
||||
# This is only true if we are cross-compiling.
|
||||
# Build all tests with host compiler and use host tools.
|
||||
set(MSAN_TEST_TARGET_CC ${COMPILER_RT_TEST_COMPILER})
|
||||
set(MSAN_TEST_TARGET_CFLAGS ${COMPILER_RT_TEST_COMPILER_CFLAGS})
|
||||
else()
|
||||
get_target_flags_for_arch(${arch} MSAN_TEST_TARGET_CFLAGS)
|
||||
string(REPLACE ";" " " MSAN_TEST_TARGET_CFLAGS "${MSAN_TEST_TARGET_CFLAGS}")
|
||||
endif()
|
||||
|
||||
get_test_cc_for_arch(${arch} MSAN_TEST_TARGET_CC MSAN_TEST_TARGET_CFLAGS)
|
||||
string(TOUPPER ${arch} ARCH_UPPER_CASE)
|
||||
set(CONFIG_NAME ${ARCH_UPPER_CASE}Config)
|
||||
|
||||
|
|
|
@ -14,13 +14,7 @@ endif()
|
|||
|
||||
foreach(arch ${PROFILE_TEST_ARCH})
|
||||
set(PROFILE_TEST_TARGET_ARCH ${arch})
|
||||
if(${arch} MATCHES "arm|aarch64")
|
||||
# This is only true if we're cross-compiling.
|
||||
set(PROFILE_TEST_TARGET_CFLAGS ${COMPILER_RT_TEST_COMPILER_CFLAGS})
|
||||
else()
|
||||
get_target_flags_for_arch(${arch} PROFILE_TEST_TARGET_CFLAGS)
|
||||
string(REPLACE ";" " " PROFILE_TEST_TARGET_CFLAGS "${PROFILE_TEST_TARGET_CFLAGS}")
|
||||
endif()
|
||||
get_test_cc_for_arch(${arch} PROFILE_TEST_TARGET_CC PROFILE_TEST_TARGET_CFLAGS)
|
||||
set(CONFIG_NAME Profile-${arch})
|
||||
configure_lit_site_cfg(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
|
||||
|
|
|
@ -27,14 +27,7 @@ foreach(tool ${SUPPORTED_TOOLS})
|
|||
foreach(arch ${TEST_ARCH})
|
||||
set(SANITIZER_COMMON_LIT_TEST_MODE ${tool})
|
||||
set(SANITIZER_COMMON_TEST_TARGET_ARCH ${arch})
|
||||
if(${arch} MATCHES "arm|aarch64")
|
||||
# This is only true if we're cross-compiling.
|
||||
set(SANITIZER_COMMON_TEST_TARGET_CFLAGS
|
||||
${COMPILER_RT_TEST_COMPILER_CFLAGS})
|
||||
else()
|
||||
get_target_flags_for_arch(${arch} SANITIZER_COMMON_TEST_TARGET_CFLAGS)
|
||||
string(REPLACE ";" " " SANITIZER_COMMON_TEST_TARGET_CFLAGS "${SANITIZER_COMMON_TEST_TARGET_CFLAGS}")
|
||||
endif()
|
||||
get_test_cc_for_arch(${arch} SANITIZER_COMMON_TEST_TARGET_CC SANITIZER_COMMON_TEST_TARGET_CFLAGS)
|
||||
set(CONFIG_NAME ${tool}-${arch}-${OS_NAME})
|
||||
configure_lit_site_cfg(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
|
||||
|
|
|
@ -24,15 +24,7 @@ endif()
|
|||
foreach(arch ${TSAN_TEST_ARCH})
|
||||
set(TSAN_TEST_TARGET_ARCH ${arch})
|
||||
string(TOLOWER "-${arch}" TSAN_TEST_CONFIG_SUFFIX)
|
||||
if(ANDROID OR ${arch} MATCHES "arm|aarch64")
|
||||
# This is only true if we are cross-compiling.
|
||||
# Build all tests with host compiler and use host tools.
|
||||
set(TSAN_TEST_TARGET_CC ${COMPILER_RT_TEST_COMPILER})
|
||||
set(TSAN_TEST_TARGET_CFLAGS ${COMPILER_RT_TEST_COMPILER_CFLAGS})
|
||||
else()
|
||||
get_target_flags_for_arch(${arch} TSAN_TEST_TARGET_CFLAGS)
|
||||
string(REPLACE ";" " " TSAN_TEST_TARGET_CFLAGS "${TSAN_TEST_TARGET_CFLAGS}")
|
||||
endif()
|
||||
get_test_cc_for_arch(${arch} TSAN_TEST_TARGET_CC TSAN_TEST_TARGET_CFLAGS)
|
||||
|
||||
string(TOUPPER ${arch} ARCH_UPPER_CASE)
|
||||
set(CONFIG_NAME ${ARCH_UPPER_CASE}Config)
|
||||
|
|
|
@ -22,13 +22,7 @@ endif()
|
|||
|
||||
foreach(arch ${UBSAN_TEST_ARCH})
|
||||
set(UBSAN_TEST_TARGET_ARCH ${arch})
|
||||
if(${arch} MATCHES "arm|aarch64")
|
||||
# This is only true if we're cross-compiling.
|
||||
set(UBSAN_TEST_TARGET_CFLAGS ${COMPILER_RT_TEST_COMPILER_CFLAGS})
|
||||
else()
|
||||
get_target_flags_for_arch(${arch} UBSAN_TEST_TARGET_CFLAGS)
|
||||
string(REPLACE ";" " " UBSAN_TEST_TARGET_CFLAGS "${UBSAN_TEST_TARGET_CFLAGS}")
|
||||
endif()
|
||||
get_test_cc_for_arch(${arch} UBSAN_TEST_TARGET_CC UBSAN_TEST_TARGET_CFLAGS)
|
||||
add_ubsan_testsuite("Standalone" ubsan ${arch})
|
||||
|
||||
if(COMPILER_RT_HAS_ASAN AND ";${ASAN_SUPPORTED_ARCH};" MATCHES ";${arch};")
|
||||
|
|
|
@ -14,17 +14,7 @@ if (COMPILER_RT_BUILD_XRAY AND COMPILER_RT_HAS_XRAY)
|
|||
foreach(arch ${XRAY_TEST_ARCH})
|
||||
set(XRAY_TEST_TARGET_ARCH ${arch})
|
||||
string(TOLOWER "-${arch}-${OS_NAME}" XRAY_TEST_CONFIG_SUFFIX)
|
||||
|
||||
if(ANDROID OR ${arch} MATCHES "arm|aarch64")
|
||||
# This is only true if we are cross-compiling.
|
||||
# Build all tests with host compiler and use host tools.
|
||||
set(XRAY_TEST_TARGET_CC ${COMPILER_RT_TEST_COMPILER})
|
||||
set(XRAY_TEST_TARGET_CFLAGS ${COMPILER_RT_TEST_COMPILER_CFLAGS})
|
||||
else()
|
||||
get_target_flags_for_arch(${arch} XRAY_TEST_TARGET_CFLAGS)
|
||||
string(REPLACE ";" " " XRAY_TEST_TARGET_CFLAGS "${XRAY_TEST_TARGET_CFLAGS}")
|
||||
endif()
|
||||
|
||||
get_test_cc_for_arch(${arch} XRAY_TEST_TARGET_CC XRAY_TEST_TARGET_CFLAGS)
|
||||
string(TOUPPER ${arch} ARCH_UPPER_CASE)
|
||||
set(CONFIG_NAME ${ARCH_UPPER_CASE}${OS_NAME}Config)
|
||||
|
||||
|
|
Loading…
Reference in New Issue