mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-10 18:11:19 +00:00
[msan] Run the tests for each supported arch and suffix each one to distinguish them.
Summary: Previously, the tests only ran for the 64-bit equivalent of the default target (see -m64). Given the supported architecture list only contains 64-bit targets, this happens to work out the same as the supported targets in most cases but may matter for X86_64/X86_64h on Darwin. For other targets, the practical effect is that the test names contain the architecture. This resolves some confusion when msan tests fail since their name no longer implies that they are trying to test the default target. Reviewers: samsonov Subscribers: tberghammer, danalbert, srhines, llvm-commits Differential Revision: http://reviews.llvm.org/D16855 llvm-svn: 260230
This commit is contained in:
parent
f1884ccb59
commit
958d69e0fc
@ -1,8 +1,32 @@
|
||||
set(MSAN_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
set(MSAN_TESTSUITES)
|
||||
|
||||
set(MSAN_TEST_ARCH ${MSAN_SUPPORTED_ARCH})
|
||||
if(APPLE)
|
||||
darwin_filter_host_archs(MSAN_SUPPORTED_ARCH MSAN_TEST_ARCH)
|
||||
endif()
|
||||
|
||||
foreach(arch ${MSAN_TEST_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()
|
||||
|
||||
string(TOUPPER ${arch} ARCH_UPPER_CASE)
|
||||
set(CONFIG_NAME ${ARCH_UPPER_CASE}Config)
|
||||
|
||||
configure_lit_site_cfg(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg)
|
||||
list(APPEND MSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
|
||||
endforeach()
|
||||
|
||||
set(MSAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
|
||||
if(NOT COMPILER_RT_STANDALONE_BUILD)
|
||||
@ -17,7 +41,7 @@ if(COMPILER_RT_INCLUDE_TESTS AND COMPILER_RT_HAS_LIBCXX_SOURCES)
|
||||
endif()
|
||||
|
||||
add_lit_testsuite(check-msan "Running the MemorySanitizer tests"
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${MSAN_TESTSUITES}
|
||||
DEPENDS ${MSAN_TEST_DEPS}
|
||||
)
|
||||
set_target_properties(check-msan PROPERTIES FOLDER "MSan tests")
|
||||
|
@ -3,17 +3,18 @@
|
||||
import os
|
||||
|
||||
# Setup config name.
|
||||
config.name = 'MemorySanitizer'
|
||||
config.name = 'MemorySanitizer' + config.name_suffix
|
||||
|
||||
# Setup source root.
|
||||
config.test_source_root = os.path.dirname(__file__)
|
||||
|
||||
# Setup default compiler flags used with -fsanitize=memory option.
|
||||
clang_msan_cflags = ["-fsanitize=memory",
|
||||
clang_msan_cflags = (["-fsanitize=memory",
|
||||
"-mno-omit-leaf-frame-pointer",
|
||||
"-fno-omit-frame-pointer",
|
||||
"-fno-optimize-sibling-calls",
|
||||
"-m64"] + config.debug_info_flags
|
||||
"-fno-optimize-sibling-calls"] +
|
||||
[config.target_cflags] +
|
||||
config.debug_info_flags)
|
||||
# Some Msan tests leverage backtrace() which requires libexecinfo on FreeBSD.
|
||||
if config.host_os == 'FreeBSD':
|
||||
clang_msan_cflags += ["-lexecinfo"]
|
||||
|
@ -1,5 +1,11 @@
|
||||
## Autogenerated by LLVM/Clang configuration.
|
||||
# Do not edit!
|
||||
|
||||
# Load common config for all compiler-rt lit tests.
|
||||
lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured")
|
||||
|
||||
# Tool-specific config options.
|
||||
config.name_suffix = "@MSAN_TEST_CONFIG_SUFFIX@"
|
||||
config.target_cflags = "@MSAN_TEST_TARGET_CFLAGS@"
|
||||
# Load tool-specific config that would do the real work.
|
||||
lit_config.load_config(config, "@MSAN_LIT_SOURCE_DIR@/lit.cfg")
|
||||
|
Loading…
Reference in New Issue
Block a user