[Sanitizer] Run test/sanitizer_common lit tests on all supported architectures.
authorAlexey Samsonov <vonosmas@gmail.com>
Mon, 2 Mar 2015 22:03:52 +0000 (22:03 +0000)
committerAlexey Samsonov <vonosmas@gmail.com>
Mon, 2 Mar 2015 22:03:52 +0000 (22:03 +0000)
llvm-svn: 231025

compiler-rt/test/sanitizer_common/CMakeLists.txt
compiler-rt/test/sanitizer_common/lit.site.cfg.in

index 13eecbd..42f2690 100644 (file)
@@ -16,16 +16,26 @@ endif()
 # Create a separate config for each tool we support.
 foreach(tool ${SUPPORTED_TOOLS})
   string(TOUPPER ${tool} tool_toupper)
-  if(${tool_toupper}_SUPPORTED_ARCH)
+  if(${tool_toupper}_SUPPORTED_ARCH AND NOT COMPILER_RT_STANDALONE_BUILD)
+    list(APPEND SANITIZER_COMMON_TEST_DEPS ${tool})
+  endif()
+  foreach(arch ${${tool_toupper}_SUPPORTED_ARCH})
     set(SANITIZER_COMMON_LIT_TEST_MODE ${tool})
+    set(SANITIZER_COMMON_TEST_TARGET_ARCH ${arch})
+    if(${arch} MATCHES "arm|aarch64")
+      # This is only true if we're cross-compiling.
+      set(SANITIZER_COMMON_TEST_TARGET_CFLAGS
+          ${COMPILER_RT_TEST_COMPILER_CFLAGS})
+    else()
+      get_target_flags_for_arch(${arch} SANITIZER_COMMON_TEST_TARGET_CFLAGS)
+    endif()
+    set(CONFIG_NAME ${tool}-${arch}-${OS_NAME})
     configure_lit_site_cfg(
       ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
-      ${CMAKE_CURRENT_BINARY_DIR}/${tool}/lit.site.cfg)
-    list(APPEND SANITIZER_COMMON_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${tool})
-    if(NOT COMPILER_RT_STANDALONE_BUILD)
-      list(APPEND SANITIZER_COMMON_TEST_DEPS ${tool})
-    endif()
-  endif()
+      ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg)
+    list(APPEND SANITIZER_COMMON_TESTSUITES
+         ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
+  endforeach()
 endforeach()
 
 # Unit tests.
index 1e94aa5..64a3edf 100644 (file)
@@ -3,6 +3,8 @@ lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configu
 
 # Tool-specific config options.
 config.tool_name = "@SANITIZER_COMMON_LIT_TEST_MODE@"
+config.target_cflags = "@SANITIZER_COMMON_TEST_TARGET_CFLAGS@"
+config.target_arch = "@SANITIZER_COMMON_TEST_TARGET_ARCH@"
 
 # Load tool-specific config that would do the real work.
 lit_config.load_config(config, "@SANITIZER_COMMON_LIT_SOURCE_DIR@/lit.common.cfg")