[compiler-rt] r260230 - [msan] Run the tests for each supported arch and suffix each one to distinguish them.

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 9 08:18:15 PST 2016


Author: dsanders
Date: Tue Feb  9 10:18:15 2016
New Revision: 260230

URL: http://llvm.org/viewvc/llvm-project?rev=260230&view=rev
Log:
[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

Modified:
    compiler-rt/trunk/test/msan/CMakeLists.txt
    compiler-rt/trunk/test/msan/lit.cfg
    compiler-rt/trunk/test/msan/lit.site.cfg.in

Modified: compiler-rt/trunk/test/msan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/msan/CMakeLists.txt?rev=260230&r1=260229&r2=260230&view=diff
==============================================================================
--- compiler-rt/trunk/test/msan/CMakeLists.txt (original)
+++ compiler-rt/trunk/test/msan/CMakeLists.txt Tue Feb  9 10:18:15 2016
@@ -1,8 +1,32 @@
 set(MSAN_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
 
-configure_lit_site_cfg(
-  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
-  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
+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}/${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 COMPILE
 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")

Modified: compiler-rt/trunk/test/msan/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/msan/lit.cfg?rev=260230&r1=260229&r2=260230&view=diff
==============================================================================
--- compiler-rt/trunk/test/msan/lit.cfg (original)
+++ compiler-rt/trunk/test/msan/lit.cfg Tue Feb  9 10:18:15 2016
@@ -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",
-                     "-mno-omit-leaf-frame-pointer",
-                     "-fno-omit-frame-pointer",
-                     "-fno-optimize-sibling-calls",
-                     "-m64"] + config.debug_info_flags
+clang_msan_cflags = (["-fsanitize=memory",
+                      "-mno-omit-leaf-frame-pointer",
+                      "-fno-omit-frame-pointer",
+                      "-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"]

Modified: compiler-rt/trunk/test/msan/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/msan/lit.site.cfg.in?rev=260230&r1=260229&r2=260230&view=diff
==============================================================================
--- compiler-rt/trunk/test/msan/lit.site.cfg.in (original)
+++ compiler-rt/trunk/test/msan/lit.site.cfg.in Tue Feb  9 10:18:15 2016
@@ -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")




More information about the llvm-commits mailing list