2014-05-09 08:28:18 +08:00
|
|
|
set(SANITIZER_COMMON_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
|
|
|
|
set(SANITIZER_COMMON_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
|
2019-09-12 09:35:11 +08:00
|
|
|
|
2014-05-09 08:28:18 +08:00
|
|
|
set(SANITIZER_COMMON_TESTSUITES)
|
|
|
|
|
Fix sanitizer tool list used to generate sanitizer_common tests to be up-to-date.
Summary:
This replaces the sanitizer tool list (used for generating
sanitizer_common configurations) with a tool list derived from
existing build system information.
Previously sanitizer_common had its own list of supported sanitizer
tools. This was bad because it was out of sync with the rest of the
build system. Notably it meant that the sanitizer_common runtime was
only being tested on Darwin the ASan dylib and not the other sanitizer
dylibs that are built for Darwin (LSan, TSan, and UBSan).
Unfortunately enabling the tests against other sanitizer dylibs has lead
to some test failures on Darwin. For now they've been marked as
XFAIL until the failures can investigated properly.
For Windows and Android we use the old sanitizer tool list to try avoid
bot breakages.
rdar://problem/47143078
Reviewers: kubamracek, george.karpenkov, yln, samsonov, vitalybuka, krytarowski
Subscribers: srhines, mgorny, fedor.sergeev, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D55740
llvm-svn: 351398
2019-01-17 07:37:31 +08:00
|
|
|
# FIXME(dliew): We should switch to COMPILER_RT_SANITIZERS_TO_BUILD instead of
|
|
|
|
# the hard coded `SUPPORTED_TOOLS_INIT` list once we know that the other
|
|
|
|
# sanitizers work.
|
|
|
|
set(SUPPORTED_TOOLS_INIT asan lsan msan tsan ubsan)
|
2014-05-13 06:48:29 +08:00
|
|
|
set(SUPPORTED_TOOLS)
|
Fix sanitizer tool list used to generate sanitizer_common tests to be up-to-date.
Summary:
This replaces the sanitizer tool list (used for generating
sanitizer_common configurations) with a tool list derived from
existing build system information.
Previously sanitizer_common had its own list of supported sanitizer
tools. This was bad because it was out of sync with the rest of the
build system. Notably it meant that the sanitizer_common runtime was
only being tested on Darwin the ASan dylib and not the other sanitizer
dylibs that are built for Darwin (LSan, TSan, and UBSan).
Unfortunately enabling the tests against other sanitizer dylibs has lead
to some test failures on Darwin. For now they've been marked as
XFAIL until the failures can investigated properly.
For Windows and Android we use the old sanitizer tool list to try avoid
bot breakages.
rdar://problem/47143078
Reviewers: kubamracek, george.karpenkov, yln, samsonov, vitalybuka, krytarowski
Subscribers: srhines, mgorny, fedor.sergeev, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D55740
llvm-svn: 351398
2019-01-17 07:37:31 +08:00
|
|
|
foreach(SANITIZER_TOOL ${SUPPORTED_TOOLS_INIT})
|
|
|
|
string(TOUPPER ${SANITIZER_TOOL} SANITIZER_TOOL_UPPER)
|
|
|
|
if (COMPILER_RT_HAS_${SANITIZER_TOOL_UPPER})
|
|
|
|
list(APPEND SUPPORTED_TOOLS ${SANITIZER_TOOL})
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
# FIXME(dliew): Remove this.
|
|
|
|
# Temporary helper for https://reviews.llvm.org/D55740
|
|
|
|
message(
|
|
|
|
STATUS
|
|
|
|
"Generated Sanitizer SUPPORTED_TOOLS list on \"${CMAKE_SYSTEM_NAME}\" is"
|
|
|
|
" \"${SUPPORTED_TOOLS}\"")
|
|
|
|
|
|
|
|
# FIXME(dliew): These tests should be made to work on all platforms.
|
|
|
|
# Use the legacy list for now.
|
|
|
|
if (ANDROID OR WINDOWS)
|
|
|
|
set(OLD_SUPPORTED_TOOLS ${SUPPORTED_TOOLS})
|
|
|
|
if (ANDROID)
|
|
|
|
set(SUPPORTED_TOOLS asan)
|
|
|
|
elseif (WINDOWS)
|
|
|
|
set(SUPPORTED_TOOLS "")
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Unhandled platform")
|
|
|
|
endif()
|
|
|
|
message(
|
|
|
|
AUTHOR_WARNING
|
|
|
|
"Replacing Sanitizer SUPPORTED_TOOLS list (${OLD_SUPPORTED_TOOLS}) with "
|
|
|
|
"\"${SUPPORTED_TOOLS}\"")
|
|
|
|
unset(OLD_SUPPORTED_TOOLS)
|
2018-01-18 19:49:45 +08:00
|
|
|
endif()
|
2014-05-13 06:48:29 +08:00
|
|
|
|
2018-12-21 19:57:31 +08:00
|
|
|
# FIXME(dliew): Remove this.
|
|
|
|
# Temporary helper for https://reviews.llvm.org/D55740
|
|
|
|
message(
|
|
|
|
STATUS
|
|
|
|
"sanitizer_common tests on \"${CMAKE_SYSTEM_NAME}\" will run against "
|
|
|
|
"\"${SUPPORTED_TOOLS}\"")
|
|
|
|
|
2014-05-09 08:28:18 +08:00
|
|
|
# Create a separate config for each tool we support.
|
2014-05-13 06:48:29 +08:00
|
|
|
foreach(tool ${SUPPORTED_TOOLS})
|
2014-05-09 08:28:18 +08:00
|
|
|
string(TOUPPER ${tool} tool_toupper)
|
2015-03-03 06:03:52 +08:00
|
|
|
if(${tool_toupper}_SUPPORTED_ARCH AND NOT COMPILER_RT_STANDALONE_BUILD)
|
|
|
|
list(APPEND SANITIZER_COMMON_TEST_DEPS ${tool})
|
|
|
|
endif()
|
2015-08-21 01:32:06 +08:00
|
|
|
set(TEST_ARCH ${${tool_toupper}_SUPPORTED_ARCH})
|
|
|
|
if(APPLE)
|
|
|
|
darwin_filter_host_archs(${tool_toupper}_SUPPORTED_ARCH TEST_ARCH)
|
|
|
|
endif()
|
2020-08-13 16:20:52 +08:00
|
|
|
if(${tool} STREQUAL "asan")
|
|
|
|
list(REMOVE_ITEM TEST_ARCH sparc sparcv9)
|
|
|
|
endif()
|
2020-11-20 21:06:25 +08:00
|
|
|
if(OS_NAME MATCHES "SunOS" AND ${tool} STREQUAL "asan")
|
|
|
|
list(REMOVE_ITEM TEST_ARCH x86_64)
|
|
|
|
endif()
|
2015-08-21 01:32:06 +08:00
|
|
|
|
Fix sanitizer tool list used to generate sanitizer_common tests to be up-to-date.
Summary:
This replaces the sanitizer tool list (used for generating
sanitizer_common configurations) with a tool list derived from
existing build system information.
Previously sanitizer_common had its own list of supported sanitizer
tools. This was bad because it was out of sync with the rest of the
build system. Notably it meant that the sanitizer_common runtime was
only being tested on Darwin the ASan dylib and not the other sanitizer
dylibs that are built for Darwin (LSan, TSan, and UBSan).
Unfortunately enabling the tests against other sanitizer dylibs has lead
to some test failures on Darwin. For now they've been marked as
XFAIL until the failures can investigated properly.
For Windows and Android we use the old sanitizer tool list to try avoid
bot breakages.
rdar://problem/47143078
Reviewers: kubamracek, george.karpenkov, yln, samsonov, vitalybuka, krytarowski
Subscribers: srhines, mgorny, fedor.sergeev, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D55740
llvm-svn: 351398
2019-01-17 07:37:31 +08:00
|
|
|
# TODO(dliew): We should iterate over the different
|
|
|
|
# Apple platforms, not just macOS.
|
2015-08-21 01:32:06 +08:00
|
|
|
foreach(arch ${TEST_ARCH})
|
2014-05-09 08:28:18 +08:00
|
|
|
set(SANITIZER_COMMON_LIT_TEST_MODE ${tool})
|
2015-03-03 06:03:52 +08:00
|
|
|
set(SANITIZER_COMMON_TEST_TARGET_ARCH ${arch})
|
2016-11-30 03:25:53 +08:00
|
|
|
get_test_cc_for_arch(${arch} SANITIZER_COMMON_TEST_TARGET_CC SANITIZER_COMMON_TEST_TARGET_CFLAGS)
|
2015-03-03 06:03:52 +08:00
|
|
|
set(CONFIG_NAME ${tool}-${arch}-${OS_NAME})
|
2021-02-12 01:24:14 +08:00
|
|
|
|
|
|
|
# ARM on Linux might use the slow unwinder as default and the unwind table is
|
|
|
|
# required to get a complete stacktrace.
|
|
|
|
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND NOT ANDROID)
|
|
|
|
list(APPEND SANITIZER_COMMON_TEST_TARGET_CFLAGS -funwind-tables)
|
2021-09-17 08:13:04 +08:00
|
|
|
if(CMAKE_SYSROOT)
|
|
|
|
list(APPEND SANITIZER_COMMON_TEST_TARGET_CFLAGS "--sysroot=${CMAKE_SYSROOT}")
|
|
|
|
endif()
|
2021-02-12 01:24:14 +08:00
|
|
|
string(REPLACE ";" " " SANITIZER_COMMON_TEST_TARGET_CFLAGS
|
|
|
|
"${SANITIZER_COMMON_TEST_TARGET_CFLAGS}")
|
|
|
|
endif()
|
|
|
|
|
2014-05-09 08:28:18 +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)
|
2021-09-04 15:31:34 +08:00
|
|
|
# FIXME(dliew): LSan i386 on Darwin is completely broken right now.
|
Fix sanitizer tool list used to generate sanitizer_common tests to be up-to-date.
Summary:
This replaces the sanitizer tool list (used for generating
sanitizer_common configurations) with a tool list derived from
existing build system information.
Previously sanitizer_common had its own list of supported sanitizer
tools. This was bad because it was out of sync with the rest of the
build system. Notably it meant that the sanitizer_common runtime was
only being tested on Darwin the ASan dylib and not the other sanitizer
dylibs that are built for Darwin (LSan, TSan, and UBSan).
Unfortunately enabling the tests against other sanitizer dylibs has lead
to some test failures on Darwin. For now they've been marked as
XFAIL until the failures can investigated properly.
For Windows and Android we use the old sanitizer tool list to try avoid
bot breakages.
rdar://problem/47143078
Reviewers: kubamracek, george.karpenkov, yln, samsonov, vitalybuka, krytarowski
Subscribers: srhines, mgorny, fedor.sergeev, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D55740
llvm-svn: 351398
2019-01-17 07:37:31 +08:00
|
|
|
# so don't run the tests by default.
|
|
|
|
if (NOT (CMAKE_SYSTEM_NAME MATCHES "Darwin" AND
|
|
|
|
${tool} STREQUAL "lsan" AND
|
|
|
|
${arch} STREQUAL "i386"))
|
|
|
|
list(APPEND SANITIZER_COMMON_TESTSUITES
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
|
|
|
|
endif()
|
2015-03-03 06:03:52 +08:00
|
|
|
endforeach()
|
2014-05-09 08:28:18 +08:00
|
|
|
endforeach()
|
|
|
|
|
|
|
|
# Unit tests.
|
2014-02-20 20:18:08 +08:00
|
|
|
if(COMPILER_RT_INCLUDE_TESTS)
|
|
|
|
configure_lit_site_cfg(
|
2019-06-28 04:56:04 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py)
|
2017-09-16 13:14:05 +08:00
|
|
|
# FIXME: support unit test in the android test runner
|
|
|
|
if (NOT ANDROID)
|
|
|
|
list(APPEND SANITIZER_COMMON_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/Unit)
|
|
|
|
list(APPEND SANITIZER_COMMON_TEST_DEPS SanitizerUnitTests)
|
|
|
|
endif()
|
2014-05-09 08:28:18 +08:00
|
|
|
endif()
|
|
|
|
|
2016-07-23 01:14:31 +08:00
|
|
|
if(SANITIZER_COMMON_TESTSUITES)
|
2014-05-09 08:28:18 +08:00
|
|
|
add_lit_testsuite(check-sanitizer "Running sanitizer_common tests"
|
|
|
|
${SANITIZER_COMMON_TESTSUITES}
|
|
|
|
DEPENDS ${SANITIZER_COMMON_TEST_DEPS})
|
|
|
|
set_target_properties(check-sanitizer PROPERTIES FOLDER
|
2016-07-12 05:51:56 +08:00
|
|
|
"Compiler-RT Misc")
|
2014-02-20 20:18:08 +08:00
|
|
|
endif()
|