2014-02-14 19:42:22 +08:00
|
|
|
set(UBSAN_LIT_TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
|
2015-02-27 03:19:44 +08:00
|
|
|
set(UBSAN_TESTSUITES)
|
2015-04-28 08:56:48 +08:00
|
|
|
set(UBSAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
|
|
|
|
|
[ubsan] Re-commit: lit changes for lld testing, future lto testing.
Summary:
As discussed in https://github.com/google/oss-fuzz/issues/933,
it would be really awesome to be able to use ThinLTO for fuzzing.
However, as @kcc has pointed out, it is currently undefined (untested)
whether the sanitizers actually function properly with LLD and/or LTO.
This patch is inspired by the cfi test, which already do test with LTO
(and/or LLD), since LTO is required for CFI to function.
I started with UBSan, because it's cmakelists / lit.* files appeared
to be the cleanest. This patch adds the infrastructure to easily add
LLD and/or LTO sub-variants of the existing lit test configurations.
Also, this patch adds the LLD flavor, that explicitly does use LLD to link.
The check-ubsan does pass on my machine. And to minimize the [initial]
potential buildbot breakage i have put some restrictions on this flavour.
Please review carefully, i have not worked with lit/sanitizer tests before.
The original attempt, r319525 was reverted in r319526 due
to the failures in compiler-rt standalone builds.
Reviewers: eugenis, vitalybuka
Reviewed By: eugenis
Subscribers: #sanitizers, pcc, kubamracek, mgorny, llvm-commits, mehdi_amini, inglorion, kcc
Differential Revision: https://reviews.llvm.org/D39508
llvm-svn: 319575
2017-12-02 03:36:29 +08:00
|
|
|
macro(add_ubsan_testsuite test_mode sanitizer arch lld thinlto)
|
2015-04-28 08:56:48 +08:00
|
|
|
set(UBSAN_LIT_TEST_MODE "${test_mode}")
|
[ubsan] Re-commit: lit changes for lld testing, future lto testing.
Summary:
As discussed in https://github.com/google/oss-fuzz/issues/933,
it would be really awesome to be able to use ThinLTO for fuzzing.
However, as @kcc has pointed out, it is currently undefined (untested)
whether the sanitizers actually function properly with LLD and/or LTO.
This patch is inspired by the cfi test, which already do test with LTO
(and/or LLD), since LTO is required for CFI to function.
I started with UBSan, because it's cmakelists / lit.* files appeared
to be the cleanest. This patch adds the infrastructure to easily add
LLD and/or LTO sub-variants of the existing lit test configurations.
Also, this patch adds the LLD flavor, that explicitly does use LLD to link.
The check-ubsan does pass on my machine. And to minimize the [initial]
potential buildbot breakage i have put some restrictions on this flavour.
Please review carefully, i have not worked with lit/sanitizer tests before.
The original attempt, r319525 was reverted in r319526 due
to the failures in compiler-rt standalone builds.
Reviewers: eugenis, vitalybuka
Reviewed By: eugenis
Subscribers: #sanitizers, pcc, kubamracek, mgorny, llvm-commits, mehdi_amini, inglorion, kcc
Differential Revision: https://reviews.llvm.org/D39508
llvm-svn: 319575
2017-12-02 03:36:29 +08:00
|
|
|
set(CONFIG_NAME ${UBSAN_LIT_TEST_MODE})
|
|
|
|
if (${lld})
|
|
|
|
set(CONFIG_NAME ${CONFIG_NAME}-lld)
|
2021-07-23 08:36:32 +08:00
|
|
|
if ("lld" IN_LIST LLVM_ENABLE_PROJECTS)
|
2019-10-25 04:14:03 +08:00
|
|
|
list(APPEND UBSAN_TEST_DEPS lld)
|
|
|
|
endif()
|
[ubsan] Re-commit: lit changes for lld testing, future lto testing.
Summary:
As discussed in https://github.com/google/oss-fuzz/issues/933,
it would be really awesome to be able to use ThinLTO for fuzzing.
However, as @kcc has pointed out, it is currently undefined (untested)
whether the sanitizers actually function properly with LLD and/or LTO.
This patch is inspired by the cfi test, which already do test with LTO
(and/or LLD), since LTO is required for CFI to function.
I started with UBSan, because it's cmakelists / lit.* files appeared
to be the cleanest. This patch adds the infrastructure to easily add
LLD and/or LTO sub-variants of the existing lit test configurations.
Also, this patch adds the LLD flavor, that explicitly does use LLD to link.
The check-ubsan does pass on my machine. And to minimize the [initial]
potential buildbot breakage i have put some restrictions on this flavour.
Please review carefully, i have not worked with lit/sanitizer tests before.
The original attempt, r319525 was reverted in r319526 due
to the failures in compiler-rt standalone builds.
Reviewers: eugenis, vitalybuka
Reviewed By: eugenis
Subscribers: #sanitizers, pcc, kubamracek, mgorny, llvm-commits, mehdi_amini, inglorion, kcc
Differential Revision: https://reviews.llvm.org/D39508
llvm-svn: 319575
2017-12-02 03:36:29 +08:00
|
|
|
endif()
|
|
|
|
if (${thinlto})
|
|
|
|
set(CONFIG_NAME ${CONFIG_NAME}-thinlto)
|
|
|
|
list(APPEND UBSAN_TEST_DEPS LTO)
|
|
|
|
endif()
|
|
|
|
set(UBSAN_TEST_USE_LLD ${lld})
|
|
|
|
set(UBSAN_TEST_USE_THINLTO ${thinlto})
|
|
|
|
set(CONFIG_NAME ${CONFIG_NAME}-${arch})
|
2015-04-28 08:56:48 +08:00
|
|
|
configure_lit_site_cfg(
|
2019-06-28 04:56:04 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py)
|
2015-04-28 08:56:48 +08:00
|
|
|
list(APPEND UBSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
|
|
|
|
if(NOT COMPILER_RT_STANDALONE_BUILD)
|
|
|
|
list(APPEND UBSAN_TEST_DEPS ${sanitizer})
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
[ubsan] Re-commit: lit changes for lld testing, future lto testing.
Summary:
As discussed in https://github.com/google/oss-fuzz/issues/933,
it would be really awesome to be able to use ThinLTO for fuzzing.
However, as @kcc has pointed out, it is currently undefined (untested)
whether the sanitizers actually function properly with LLD and/or LTO.
This patch is inspired by the cfi test, which already do test with LTO
(and/or LLD), since LTO is required for CFI to function.
I started with UBSan, because it's cmakelists / lit.* files appeared
to be the cleanest. This patch adds the infrastructure to easily add
LLD and/or LTO sub-variants of the existing lit test configurations.
Also, this patch adds the LLD flavor, that explicitly does use LLD to link.
The check-ubsan does pass on my machine. And to minimize the [initial]
potential buildbot breakage i have put some restrictions on this flavour.
Please review carefully, i have not worked with lit/sanitizer tests before.
The original attempt, r319525 was reverted in r319526 due
to the failures in compiler-rt standalone builds.
Reviewers: eugenis, vitalybuka
Reviewed By: eugenis
Subscribers: #sanitizers, pcc, kubamracek, mgorny, llvm-commits, mehdi_amini, inglorion, kcc
Differential Revision: https://reviews.llvm.org/D39508
llvm-svn: 319575
2017-12-02 03:36:29 +08:00
|
|
|
macro(add_ubsan_testsuites test_mode sanitizer arch)
|
|
|
|
add_ubsan_testsuite(${test_mode} ${sanitizer} ${arch} False False)
|
|
|
|
|
|
|
|
if(COMPILER_RT_HAS_LLD AND arch STREQUAL "x86_64" AND NOT (APPLE OR WIN32))
|
|
|
|
add_ubsan_testsuite(${test_mode} ${sanitizer} ${arch} True False)
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
2015-08-22 02:06:00 +08:00
|
|
|
set(UBSAN_TEST_ARCH ${UBSAN_SUPPORTED_ARCH})
|
|
|
|
if(APPLE)
|
|
|
|
darwin_filter_host_archs(UBSAN_SUPPORTED_ARCH UBSAN_TEST_ARCH)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
foreach(arch ${UBSAN_TEST_ARCH})
|
2015-02-27 03:19:44 +08:00
|
|
|
set(UBSAN_TEST_TARGET_ARCH ${arch})
|
2020-02-15 03:35:06 +08:00
|
|
|
if (APPLE)
|
|
|
|
set(UBSAN_TEST_APPLE_PLATFORM "osx")
|
|
|
|
set(UBSAN_TEST_MIN_DEPLOYMENT_TARGET_FLAG "${DARWIN_osx_MIN_VER_FLAG}")
|
|
|
|
endif()
|
2016-11-30 03:25:53 +08:00
|
|
|
get_test_cc_for_arch(${arch} UBSAN_TEST_TARGET_CC UBSAN_TEST_TARGET_CFLAGS)
|
[ubsan] Re-commit: lit changes for lld testing, future lto testing.
Summary:
As discussed in https://github.com/google/oss-fuzz/issues/933,
it would be really awesome to be able to use ThinLTO for fuzzing.
However, as @kcc has pointed out, it is currently undefined (untested)
whether the sanitizers actually function properly with LLD and/or LTO.
This patch is inspired by the cfi test, which already do test with LTO
(and/or LLD), since LTO is required for CFI to function.
I started with UBSan, because it's cmakelists / lit.* files appeared
to be the cleanest. This patch adds the infrastructure to easily add
LLD and/or LTO sub-variants of the existing lit test configurations.
Also, this patch adds the LLD flavor, that explicitly does use LLD to link.
The check-ubsan does pass on my machine. And to minimize the [initial]
potential buildbot breakage i have put some restrictions on this flavour.
Please review carefully, i have not worked with lit/sanitizer tests before.
The original attempt, r319525 was reverted in r319526 due
to the failures in compiler-rt standalone builds.
Reviewers: eugenis, vitalybuka
Reviewed By: eugenis
Subscribers: #sanitizers, pcc, kubamracek, mgorny, llvm-commits, mehdi_amini, inglorion, kcc
Differential Revision: https://reviews.llvm.org/D39508
llvm-svn: 319575
2017-12-02 03:36:29 +08:00
|
|
|
add_ubsan_testsuites("Standalone" ubsan ${arch})
|
2015-02-27 03:19:44 +08:00
|
|
|
|
2015-12-10 08:40:58 +08:00
|
|
|
if(COMPILER_RT_HAS_ASAN AND ";${ASAN_SUPPORTED_ARCH};" MATCHES ";${arch};")
|
2016-05-28 05:29:31 +08:00
|
|
|
# TODO(wwchrome): Re-enable ubsan for asan win 64-bit when ready.
|
2019-07-12 16:30:17 +08:00
|
|
|
# Disable ubsan with AddressSanitizer tests for Windows 64-bit,
|
|
|
|
# 64-bit Solaris/x86, and SPARC.
|
2019-07-08 17:18:38 +08:00
|
|
|
if((NOT (OS_NAME MATCHES "Windows" AND CMAKE_SIZEOF_VOID_P EQUAL 8)) AND
|
2019-07-12 16:30:17 +08:00
|
|
|
(NOT (OS_NAME MATCHES "SunOS" AND ${arch} MATCHES x86_64)) AND
|
|
|
|
(NOT ${arch} MATCHES sparc))
|
[ubsan] Re-commit: lit changes for lld testing, future lto testing.
Summary:
As discussed in https://github.com/google/oss-fuzz/issues/933,
it would be really awesome to be able to use ThinLTO for fuzzing.
However, as @kcc has pointed out, it is currently undefined (untested)
whether the sanitizers actually function properly with LLD and/or LTO.
This patch is inspired by the cfi test, which already do test with LTO
(and/or LLD), since LTO is required for CFI to function.
I started with UBSan, because it's cmakelists / lit.* files appeared
to be the cleanest. This patch adds the infrastructure to easily add
LLD and/or LTO sub-variants of the existing lit test configurations.
Also, this patch adds the LLD flavor, that explicitly does use LLD to link.
The check-ubsan does pass on my machine. And to minimize the [initial]
potential buildbot breakage i have put some restrictions on this flavour.
Please review carefully, i have not worked with lit/sanitizer tests before.
The original attempt, r319525 was reverted in r319526 due
to the failures in compiler-rt standalone builds.
Reviewers: eugenis, vitalybuka
Reviewed By: eugenis
Subscribers: #sanitizers, pcc, kubamracek, mgorny, llvm-commits, mehdi_amini, inglorion, kcc
Differential Revision: https://reviews.llvm.org/D39508
llvm-svn: 319575
2017-12-02 03:36:29 +08:00
|
|
|
add_ubsan_testsuites("AddressSanitizer" asan ${arch})
|
2016-05-28 05:29:31 +08:00
|
|
|
endif()
|
2015-04-28 08:56:48 +08:00
|
|
|
endif()
|
2015-12-10 08:40:58 +08:00
|
|
|
if(COMPILER_RT_HAS_MSAN AND ";${MSAN_SUPPORTED_ARCH};" MATCHES ";${arch};")
|
[ubsan] Re-commit: lit changes for lld testing, future lto testing.
Summary:
As discussed in https://github.com/google/oss-fuzz/issues/933,
it would be really awesome to be able to use ThinLTO for fuzzing.
However, as @kcc has pointed out, it is currently undefined (untested)
whether the sanitizers actually function properly with LLD and/or LTO.
This patch is inspired by the cfi test, which already do test with LTO
(and/or LLD), since LTO is required for CFI to function.
I started with UBSan, because it's cmakelists / lit.* files appeared
to be the cleanest. This patch adds the infrastructure to easily add
LLD and/or LTO sub-variants of the existing lit test configurations.
Also, this patch adds the LLD flavor, that explicitly does use LLD to link.
The check-ubsan does pass on my machine. And to minimize the [initial]
potential buildbot breakage i have put some restrictions on this flavour.
Please review carefully, i have not worked with lit/sanitizer tests before.
The original attempt, r319525 was reverted in r319526 due
to the failures in compiler-rt standalone builds.
Reviewers: eugenis, vitalybuka
Reviewed By: eugenis
Subscribers: #sanitizers, pcc, kubamracek, mgorny, llvm-commits, mehdi_amini, inglorion, kcc
Differential Revision: https://reviews.llvm.org/D39508
llvm-svn: 319575
2017-12-02 03:36:29 +08:00
|
|
|
add_ubsan_testsuites("MemorySanitizer" msan ${arch})
|
2015-04-28 08:56:48 +08:00
|
|
|
endif()
|
2017-10-07 04:51:51 +08:00
|
|
|
if(COMPILER_RT_HAS_TSAN AND ";${TSAN_SUPPORTED_ARCH};" MATCHES ";${arch};" AND NOT ANDROID)
|
[ubsan] Re-commit: lit changes for lld testing, future lto testing.
Summary:
As discussed in https://github.com/google/oss-fuzz/issues/933,
it would be really awesome to be able to use ThinLTO for fuzzing.
However, as @kcc has pointed out, it is currently undefined (untested)
whether the sanitizers actually function properly with LLD and/or LTO.
This patch is inspired by the cfi test, which already do test with LTO
(and/or LLD), since LTO is required for CFI to function.
I started with UBSan, because it's cmakelists / lit.* files appeared
to be the cleanest. This patch adds the infrastructure to easily add
LLD and/or LTO sub-variants of the existing lit test configurations.
Also, this patch adds the LLD flavor, that explicitly does use LLD to link.
The check-ubsan does pass on my machine. And to minimize the [initial]
potential buildbot breakage i have put some restrictions on this flavour.
Please review carefully, i have not worked with lit/sanitizer tests before.
The original attempt, r319525 was reverted in r319526 due
to the failures in compiler-rt standalone builds.
Reviewers: eugenis, vitalybuka
Reviewed By: eugenis
Subscribers: #sanitizers, pcc, kubamracek, mgorny, llvm-commits, mehdi_amini, inglorion, kcc
Differential Revision: https://reviews.llvm.org/D39508
llvm-svn: 319575
2017-12-02 03:36:29 +08:00
|
|
|
add_ubsan_testsuites("ThreadSanitizer" tsan ${arch})
|
2015-02-27 03:19:44 +08:00
|
|
|
endif()
|
|
|
|
endforeach()
|
2014-02-14 19:42:22 +08:00
|
|
|
|
2018-09-03 18:30:10 +08:00
|
|
|
macro(add_ubsan_device_testsuite test_mode sanitizer platform arch)
|
|
|
|
# Note we expect the caller to have already set UBSAN_TEST_TARGET_CFLAGS
|
|
|
|
set(UBSAN_LIT_TEST_MODE "${test_mode}")
|
|
|
|
set(CONFIG_NAME ${UBSAN_LIT_TEST_MODE}-${platform}-${arch})
|
|
|
|
set(UBSAN_TEST_TARGET_ARCH ${arch})
|
|
|
|
set(UBSAN_TEST_USE_LLD "False")
|
|
|
|
set(UBSAN_TEST_USE_THINLTO "False")
|
|
|
|
if (APPLE)
|
|
|
|
set(UBSAN_TEST_APPLE_PLATFORM "${platform}")
|
2020-02-15 03:35:06 +08:00
|
|
|
set(UBSAN_TEST_MIN_DEPLOYMENT_TARGET_FLAG "${DARWIN_${platform}_MIN_VER_FLAG}")
|
2018-09-03 18:30:10 +08:00
|
|
|
else()
|
|
|
|
unset(UBSAN_TEST_APPLE_PLATFORM)
|
2020-02-15 03:35:06 +08:00
|
|
|
unset(UBSAN_TEST_MIN_DEPLOYMENT_TARGET_FLAG)
|
2018-09-03 18:30:10 +08:00
|
|
|
endif()
|
|
|
|
configure_lit_site_cfg(
|
2019-06-28 04:56:04 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py)
|
2018-09-03 18:30:10 +08:00
|
|
|
#list(APPEND UBSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
|
|
|
|
if(NOT COMPILER_RT_STANDALONE_BUILD)
|
|
|
|
list(APPEND UBSAN_TEST_DEPS ${sanitizer})
|
|
|
|
endif()
|
|
|
|
add_lit_testsuite(check-ubsan-${test_mode}-${platform}-${arch}
|
|
|
|
"UBSan ${CONFIG_NAME} tests"
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/
|
2020-02-07 07:26:10 +08:00
|
|
|
EXCLUDE_FROM_CHECK_ALL
|
2018-09-03 18:30:10 +08:00
|
|
|
DEPENDS ${UBSAN_TEST_DEPS})
|
|
|
|
endmacro()
|
|
|
|
|
2017-10-07 09:46:36 +08:00
|
|
|
if(APPLE)
|
|
|
|
foreach(arch ${UBSAN_TEST_ARCH})
|
|
|
|
set(UBSAN_TEST_TARGET_ARCH ${arch})
|
|
|
|
get_test_cc_for_arch(${arch} UBSAN_TEST_TARGET_CC UBSAN_TEST_TARGET_CFLAGS)
|
2017-10-08 04:20:42 +08:00
|
|
|
set(UBSAN_TEST_TARGET_CFLAGS "${UBSAN_TEST_TARGET_CFLAGS} -lc++abi")
|
[ubsan] Re-commit: lit changes for lld testing, future lto testing.
Summary:
As discussed in https://github.com/google/oss-fuzz/issues/933,
it would be really awesome to be able to use ThinLTO for fuzzing.
However, as @kcc has pointed out, it is currently undefined (untested)
whether the sanitizers actually function properly with LLD and/or LTO.
This patch is inspired by the cfi test, which already do test with LTO
(and/or LLD), since LTO is required for CFI to function.
I started with UBSan, because it's cmakelists / lit.* files appeared
to be the cleanest. This patch adds the infrastructure to easily add
LLD and/or LTO sub-variants of the existing lit test configurations.
Also, this patch adds the LLD flavor, that explicitly does use LLD to link.
The check-ubsan does pass on my machine. And to minimize the [initial]
potential buildbot breakage i have put some restrictions on this flavour.
Please review carefully, i have not worked with lit/sanitizer tests before.
The original attempt, r319525 was reverted in r319526 due
to the failures in compiler-rt standalone builds.
Reviewers: eugenis, vitalybuka
Reviewed By: eugenis
Subscribers: #sanitizers, pcc, kubamracek, mgorny, llvm-commits, mehdi_amini, inglorion, kcc
Differential Revision: https://reviews.llvm.org/D39508
llvm-svn: 319575
2017-12-02 03:36:29 +08:00
|
|
|
add_ubsan_testsuites("StandaloneStatic" ubsan ${arch})
|
2017-10-07 09:46:36 +08:00
|
|
|
endforeach()
|
2018-09-03 18:30:10 +08:00
|
|
|
|
|
|
|
# Device and simulator test suites.
|
|
|
|
# These are not added into "check-all", in order to run these tests, use
|
|
|
|
# "check-asan-iossim-x86_64" and similar. They also require that an extra env
|
|
|
|
# variable to select which iOS device or simulator to use, e.g.:
|
|
|
|
# SANITIZER_IOSSIM_TEST_DEVICE_IDENTIFIER="iPhone 6"
|
2021-11-09 09:19:57 +08:00
|
|
|
set(UBSAN_APPLE_PLATFORMS ${UBSAN_SUPPORTED_OS})
|
2018-09-03 18:30:10 +08:00
|
|
|
foreach(platform ${UBSAN_APPLE_PLATFORMS})
|
2019-10-02 07:08:18 +08:00
|
|
|
list_intersect(
|
|
|
|
UBSAN_TEST_${platform}_ARCHS
|
|
|
|
UBSAN_SUPPORTED_ARCH
|
|
|
|
DARWIN_${platform}_ARCHS
|
|
|
|
)
|
|
|
|
foreach(arch ${UBSAN_TEST_${platform}_ARCHS})
|
|
|
|
get_test_cflags_for_apple_platform(
|
|
|
|
"${platform}"
|
|
|
|
"${arch}"
|
|
|
|
UBSAN_TEST_TARGET_CFLAGS
|
|
|
|
)
|
|
|
|
add_ubsan_device_testsuite("Standalone" ubsan ${platform} ${arch})
|
2018-09-03 18:30:10 +08:00
|
|
|
|
|
|
|
if(COMPILER_RT_HAS_ASAN AND ";${ASAN_SUPPORTED_ARCH};" MATCHES ";${arch};")
|
|
|
|
add_ubsan_device_testsuite("AddressSanitizer" asan ${platform} ${arch})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(COMPILER_RT_HAS_TSAN AND ";${TSAN_SUPPORTED_ARCH};" MATCHES ";${arch};")
|
|
|
|
add_ubsan_device_testsuite("ThreadSanitizer" tsan ${platform} ${arch})
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endforeach()
|
2017-10-07 09:46:36 +08:00
|
|
|
endif()
|
|
|
|
|
2014-02-14 19:42:22 +08:00
|
|
|
add_lit_testsuite(check-ubsan "Running UndefinedBehaviorSanitizer tests"
|
2014-05-30 06:38:13 +08:00
|
|
|
${UBSAN_TESTSUITES}
|
2014-02-14 19:42:22 +08:00
|
|
|
DEPENDS ${UBSAN_TEST_DEPS})
|
2016-07-12 05:51:56 +08:00
|
|
|
set_target_properties(check-ubsan PROPERTIES FOLDER "Compiler-RT Misc")
|
2018-09-03 18:30:10 +08:00
|
|
|
|