Skip to content

Commit 922f95c

Browse files
committedFeb 9, 2016
[dfsan] 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, llvm-commits, srhines Differential Revision: http://reviews.llvm.org/D16856 llvm-svn: 260231
1 parent 958d69e commit 922f95c

File tree

3 files changed

+37
-6
lines changed

3 files changed

+37
-6
lines changed
 

‎compiler-rt/test/dfsan/CMakeLists.txt

+28-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,39 @@
11
set(DFSAN_LIT_TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR})
22

3-
configure_lit_site_cfg(
4-
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
5-
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
3+
set(DFSAN_TESTSUITES)
4+
5+
set(DFSAN_TEST_ARCH ${DFSAN_SUPPORTED_ARCH})
6+
if(APPLE)
7+
darwin_filter_host_archs(DFSAN_SUPPORTED_ARCH DFSAN_TEST_ARCH)
8+
endif()
9+
10+
foreach(arch ${DFSAN_TEST_ARCH})
11+
string(TOLOWER "-${arch}" DFSAN_TEST_CONFIG_SUFFIX)
12+
if(ANDROID OR ${arch} MATCHES "arm|aarch64")
13+
# This is only true if we are cross-compiling.
14+
# Build all tests with host compiler and use host tools.
15+
set(DFSAN_TEST_TARGET_CC ${COMPILER_RT_TEST_COMPILER})
16+
set(DFSAN_TEST_TARGET_CFLAGS ${COMPILER_RT_TEST_COMPILER_CFLAGS})
17+
else()
18+
get_target_flags_for_arch(${arch} DFSAN_TEST_TARGET_CFLAGS)
19+
string(REPLACE ";" " " DFSAN_TEST_TARGET_CFLAGS "${DFSAN_TEST_TARGET_CFLAGS}")
20+
endif()
21+
22+
string(TOUPPER ${arch} ARCH_UPPER_CASE)
23+
set(CONFIG_NAME ${ARCH_UPPER_CASE}Config)
24+
25+
configure_lit_site_cfg(
26+
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
27+
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg)
28+
list(APPEND DFSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
29+
endforeach()
630

731
set(DFSAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
832
if(NOT COMPILER_RT_STANDALONE_BUILD)
933
list(APPEND DFSAN_TEST_DEPS dfsan)
1034
endif()
1135

1236
add_lit_testsuite(check-dfsan "Running the DataFlowSanitizer tests"
13-
${CMAKE_CURRENT_BINARY_DIR}
37+
${DFSAN_TESTSUITES}
1438
DEPENDS ${DFSAN_TEST_DEPS})
1539
set_target_properties(check-dfsan PROPERTIES FOLDER "DFSan tests")

‎compiler-rt/test/dfsan/lit.cfg

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
import os
44

55
# Setup config name.
6-
config.name = 'DataFlowSanitizer'
6+
config.name = 'DataFlowSanitizer' + config.name_suffix
77

88
# Setup source root.
99
config.test_source_root = os.path.dirname(__file__)
1010

1111
# Setup default compiler flags used with -fsanitize=dataflow option.
12-
clang_dfsan_cflags = ["-fsanitize=dataflow", "-m64"]
12+
clang_dfsan_cflags = ["-fsanitize=dataflow", config.target_cflags]
1313
clang_dfsan_cxxflags = config.cxx_mode_flags + clang_dfsan_cflags
1414

1515
def build_invocation(compile_flags):
+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1+
## Autogenerated by LLVM/Clang configuration.
2+
# Do not edit!
3+
14
# Load common config for all compiler-rt lit tests.
25
lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured")
36

7+
# Tool-specific config options.
8+
config.name_suffix = "@DFSAN_TEST_CONFIG_SUFFIX@"
9+
config.target_cflags = "@DFSAN_TEST_TARGET_CFLAGS@"
10+
411
# Load tool-specific config that would do the real work.
512
lit_config.load_config(config, "@DFSAN_LIT_TESTS_DIR@/lit.cfg")

0 commit comments

Comments
 (0)