[compiler-rt] r201403 - Move DFSan test suite under test/

Alexey Samsonov samsonov at google.com
Fri Feb 14 04:05:42 PST 2014


Author: samsonov
Date: Fri Feb 14 06:05:41 2014
New Revision: 201403

URL: http://llvm.org/viewvc/llvm-project?rev=201403&view=rev
Log:
Move DFSan test suite under test/

Added:
    compiler-rt/trunk/test/dfsan/
      - copied from r201399, compiler-rt/trunk/lib/dfsan/lit_tests/
Removed:
    compiler-rt/trunk/lib/dfsan/lit_tests/
Modified:
    compiler-rt/trunk/CMakeLists.txt
    compiler-rt/trunk/lib/dfsan/CMakeLists.txt
    compiler-rt/trunk/lib/dfsan/scripts/check_custom_wrappers.sh
    compiler-rt/trunk/test/CMakeLists.txt
    compiler-rt/trunk/test/dfsan/CMakeLists.txt
    compiler-rt/trunk/test/dfsan/lit.cfg
    compiler-rt/trunk/test/dfsan/lit.site.cfg.in

Modified: compiler-rt/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=201403&r1=201402&r2=201403&view=diff
==============================================================================
--- compiler-rt/trunk/CMakeLists.txt (original)
+++ compiler-rt/trunk/CMakeLists.txt Fri Feb 14 06:05:41 2014
@@ -231,8 +231,8 @@ endif()
 # support only subset of these (e.g. TSan works on x86_64 only).
 filter_available_targets(SANITIZER_COMMON_SUPPORTED_ARCH
   x86_64 i386 powerpc64 arm)
-filter_available_targets(UBSAN_SUPPORTED_ARCH
-  x86_64 i386)
+filter_available_targets(DFSAN_SUPPORTED_ARCH x86_64)
+filter_available_targets(UBSAN_SUPPORTED_ARCH x86_64 i386)
 
 add_subdirectory(include)
 

Modified: compiler-rt/trunk/lib/dfsan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/dfsan/CMakeLists.txt?rev=201403&r1=201402&r2=201403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/dfsan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/dfsan/CMakeLists.txt Fri Feb 14 06:05:41 2014
@@ -10,10 +10,8 @@ set(DFSAN_RTL_CFLAGS
   # Prevent clang from generating libc calls.
   -ffreestanding)
 
-filter_available_targets(DFSAN_SUPPORTED_ARCH x86_64)
-
 # Static runtime library.
-set(DFSAN_RUNTIME_LIBRARIES)
+add_custom_target(dfsan)
 set(arch "x86_64")
 if(CAN_TARGET_${arch})
   add_compiler_rt_static_runtime(clang_rt.dfsan-${arch} ${arch}
@@ -27,8 +25,9 @@ if(CAN_TARGET_${arch})
             $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
             CFLAGS ${DFSAN_RTL_CFLAGS} -fPIC -DDFSAN_NOLIBC)
   add_sanitizer_rt_symbols(clang_rt.dfsan-${arch} dfsan.syms.extra)
-  list(APPEND DFSAN_RUNTIME_LIBRARIES clang_rt.dfsan-${arch}
-                                      clang_rt.dfsan-${arch}-symbols)
+  add_dependencies(dfsan
+    clang_rt.dfsan-${arch}
+    clang_rt.dfsan-${arch}-symbols)
 endif()
 
 add_custom_target(dfsan_abilist ALL
@@ -40,9 +39,6 @@ add_custom_command(OUTPUT ${CLANG_RESOUR
                          ${CMAKE_CURRENT_SOURCE_DIR}/libc_ubuntu1204_abilist.txt
                          > ${CLANG_RESOURCE_DIR}/dfsan_abilist.txt
                    DEPENDS done_abilist.txt libc_ubuntu1204_abilist.txt)
+add_dependencies(dfsan dfsan_abilist)
 install(FILES ${CLANG_RESOURCE_DIR}/dfsan_abilist.txt
         DESTINATION ${LIBCLANG_INSTALL_PATH})
-
-if(DFSAN_SUPPORTED_ARCH)
-  add_subdirectory(lit_tests)
-endif()

Modified: compiler-rt/trunk/lib/dfsan/scripts/check_custom_wrappers.sh
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/dfsan/scripts/check_custom_wrappers.sh?rev=201403&r1=201402&r2=201403&view=diff
==============================================================================
--- compiler-rt/trunk/lib/dfsan/scripts/check_custom_wrappers.sh (original)
+++ compiler-rt/trunk/lib/dfsan/scripts/check_custom_wrappers.sh Fri Feb 14 06:05:41 2014
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 DFSAN_DIR=$(dirname "$0")/../
-DFSAN_CUSTOM_TESTS=${DFSAN_DIR}/lit_tests/custom.c
+DFSAN_CUSTOM_TESTS=${DFSAN_DIR}/../../test/dfsan/custom.c
 DFSAN_CUSTOM_WRAPPERS=${DFSAN_DIR}/dfsan_custom.cc
 DFSAN_ABI_LIST=${DFSAN_DIR}/done_abilist.txt
 

Modified: compiler-rt/trunk/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/CMakeLists.txt?rev=201403&r1=201402&r2=201403&view=diff
==============================================================================
--- compiler-rt/trunk/test/CMakeLists.txt (original)
+++ compiler-rt/trunk/test/CMakeLists.txt Fri Feb 14 06:05:41 2014
@@ -9,6 +9,9 @@ configure_lit_site_cfg(
 # Run sanitizer tests only if we're sure that clang would produce
 # working binaries.
 if(COMPILER_RT_CAN_EXECUTE_TESTS)
+  if(DFSAN_SUPPORTED_ARCH)
+    add_subdirectory(dfsan)
+  endif()
   if(UBSAN_SUPPORTED_ARCH)
     add_subdirectory(ubsan)
   endif()

Modified: compiler-rt/trunk/test/dfsan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/dfsan/CMakeLists.txt?rev=201403&r1=201399&r2=201403&view=diff
==============================================================================
--- compiler-rt/trunk/test/dfsan/CMakeLists.txt (original)
+++ compiler-rt/trunk/test/dfsan/CMakeLists.txt Fri Feb 14 06:05:41 2014
@@ -1,21 +1,13 @@
-set(DFSAN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..)
-set(DFSAN_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/..)
+set(DFSAN_LIT_TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR})
 
 configure_lit_site_cfg(
   ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
   ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
 
-if(COMPILER_RT_CAN_EXECUTE_TESTS)
-  # Run DFSan tests only if we're sure we may produce working binaries.
-  set(DFSAN_TEST_DEPS
-    ${SANITIZER_COMMON_LIT_TEST_DEPS}
-    ${DFSAN_RUNTIME_LIBRARIES}
-    dfsan_abilist)
-  set(DFSAN_TEST_PARAMS
-    dfsan_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
-  add_lit_testsuite(check-dfsan "Running the DataFlowSanitizer tests"
-    ${CMAKE_CURRENT_BINARY_DIR}
-    PARAMS ${DFSAN_TEST_PARAMS}
-    DEPENDS ${DFSAN_TEST_DEPS})
-  set_target_properties(check-dfsan PROPERTIES FOLDER "DFSan tests")
-endif()
+set(DFSAN_TEST_DEPS
+  ${SANITIZER_COMMON_LIT_TEST_DEPS}
+  dfsan)
+add_lit_testsuite(check-dfsan "Running the DataFlowSanitizer tests"
+  ${CMAKE_CURRENT_BINARY_DIR}
+  DEPENDS ${DFSAN_TEST_DEPS})
+set_target_properties(check-dfsan PROPERTIES FOLDER "DFSan tests")

Modified: compiler-rt/trunk/test/dfsan/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/dfsan/lit.cfg?rev=201403&r1=201399&r2=201403&view=diff
==============================================================================
--- compiler-rt/trunk/test/dfsan/lit.cfg (original)
+++ compiler-rt/trunk/test/dfsan/lit.cfg Fri Feb 14 06:05:41 2014
@@ -2,55 +2,12 @@
 
 import os
 
-import lit.util
-
-def get_required_attr(config, attr_name):
-  attr_value = getattr(config, attr_name, None)
-  if not attr_value:
-    lit_config.fatal(
-      "No attribute %r in test configuration! You may need to run "
-      "tests from your build directory or add this attribute "
-      "to lit.site.cfg " % attr_name)
-  return attr_value
-
 # Setup config name.
 config.name = 'DataFlowSanitizer'
 
 # Setup source root.
 config.test_source_root = os.path.dirname(__file__)
 
-def DisplayNoConfigMessage():
-  lit_config.fatal("No site specific configuration available! " +
-                   "Try running your test from the build tree or running " +
-                   "make check-dfsan")
-
-# Figure out LLVM source root.
-llvm_src_root = getattr(config, 'llvm_src_root', None)
-if llvm_src_root is None:
-  # We probably haven't loaded the site-specific configuration: the user
-  # is likely trying to run a test file directly, and the site configuration
-  # wasn't created by the build system.
-  dfsan_site_cfg = lit_config.params.get('dfsan_site_config', None)
-  if (dfsan_site_cfg) and (os.path.exists(dfsan_site_cfg)):
-    lit_config.load_config(config, dfsan_site_cfg)
-    raise SystemExit
-
-  # Try to guess the location of site-specific configuration using llvm-config
-  # util that can point where the build tree is.
-  llvm_config = lit.util.which("llvm-config", config.environment["PATH"])
-  if not llvm_config:
-    DisplayNoConfigMessage()
-
-  # Find out the presumed location of generated site config.
-  llvm_obj_root = lit.util.capture(["llvm-config", "--obj-root"]).strip()
-  dfsan_site_cfg = os.path.join(llvm_obj_root, "projects", "compiler-rt",
-                               "lib", "dfsan", "lit_tests", "lit.site.cfg")
-  if (not dfsan_site_cfg) or (not os.path.exists(dfsan_site_cfg)):
-    DisplayNoConfigMessage()
-
-  lit_config.load_config(config, dfsan_site_cfg)
-  raise SystemExit
-
 # Setup default compiler flags used with -fsanitize=dataflow option.
 clang_dfsan_cflags = ["-fsanitize=dataflow"]
 clang_dfsan_cxxflags = ["--driver-mode=g++ "] + clang_dfsan_cflags

Modified: compiler-rt/trunk/test/dfsan/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/dfsan/lit.site.cfg.in?rev=201403&r1=201399&r2=201403&view=diff
==============================================================================
--- compiler-rt/trunk/test/dfsan/lit.site.cfg.in (original)
+++ compiler-rt/trunk/test/dfsan/lit.site.cfg.in Fri Feb 14 06:05:41 2014
@@ -2,4 +2,4 @@
 lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured")
 
 # Load tool-specific config that would do the real work.
-lit_config.load_config(config, "@DFSAN_SOURCE_DIR@/lit_tests/lit.cfg")
+lit_config.load_config(config, "@DFSAN_LIT_TESTS_DIR@/lit.cfg")





More information about the llvm-commits mailing list