[compiler-rt] r201401 - Move UBSan test suite under test/

Alexey Samsonov samsonov at google.com
Fri Feb 14 03:42:22 PST 2014


Author: samsonov
Date: Fri Feb 14 05:42:22 2014
New Revision: 201401

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

Added:
    compiler-rt/trunk/test/ubsan/
      - copied from r201396, compiler-rt/trunk/lib/ubsan/lit_tests/
    compiler-rt/trunk/test/ubsan/AsanConfig/lit.site.cfg.in
      - copied unchanged from r201399, compiler-rt/trunk/lib/ubsan/lit_tests/AsanConfig/lit.site.cfg.in
    compiler-rt/trunk/test/ubsan/UbsanConfig/lit.site.cfg.in
      - copied unchanged from r201399, compiler-rt/trunk/lib/ubsan/lit_tests/UbsanConfig/lit.site.cfg.in
Removed:
    compiler-rt/trunk/lib/ubsan/lit_tests/AsanConfig/
    compiler-rt/trunk/lib/ubsan/lit_tests/CMakeLists.txt
    compiler-rt/trunk/lib/ubsan/lit_tests/TestCases/
    compiler-rt/trunk/lib/ubsan/lit_tests/UbsanConfig/
    compiler-rt/trunk/lib/ubsan/lit_tests/lit.common.cfg
Modified:
    compiler-rt/trunk/CMakeLists.txt
    compiler-rt/trunk/lib/ubsan/CMakeLists.txt
    compiler-rt/trunk/test/CMakeLists.txt
    compiler-rt/trunk/test/ubsan/CMakeLists.txt

Modified: compiler-rt/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=201401&r1=201400&r2=201401&view=diff
==============================================================================
--- compiler-rt/trunk/CMakeLists.txt (original)
+++ compiler-rt/trunk/CMakeLists.txt Fri Feb 14 05:42:22 2014
@@ -231,6 +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)
 
 add_subdirectory(include)
 

Modified: compiler-rt/trunk/lib/ubsan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/CMakeLists.txt?rev=201401&r1=201400&r2=201401&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ubsan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/ubsan/CMakeLists.txt Fri Feb 14 05:42:22 2014
@@ -15,10 +15,7 @@ include_directories(..)
 
 set(UBSAN_CFLAGS ${SANITIZER_COMMON_CFLAGS})
 
-filter_available_targets(UBSAN_SUPPORTED_ARCH
-  x86_64 i386)
-
-set(UBSAN_RUNTIME_LIBRARIES)
+add_custom_target(ubsan)
 
 if(APPLE)
   # Build universal binary on APPLE.
@@ -27,7 +24,7 @@ if(APPLE)
     SOURCES ${UBSAN_SOURCES} ${UBSAN_CXX_SOURCES}
             $<TARGET_OBJECTS:RTSanitizerCommon.osx>
     CFLAGS ${UBSAN_CFLAGS})
-  list(APPEND UBSAN_RUNTIME_LIBRARIES clang_rt.ubsan_osx)
+  add_dependencies(ubsan clang_rt.ubsan_osx)
 else()
   # Build separate libraries for each target.
   foreach(arch ${UBSAN_SUPPORTED_ARCH})
@@ -39,20 +36,16 @@ else()
     add_compiler_rt_static_runtime(clang_rt.ubsan_cxx-${arch} ${arch}
       SOURCES ${UBSAN_CXX_SOURCES}
       CFLAGS ${UBSAN_CFLAGS})
-    list(APPEND UBSAN_RUNTIME_LIBRARIES
+    add_dependencies(ubsan
       clang_rt.san-${arch}
       clang_rt.ubsan-${arch}
       clang_rt.ubsan_cxx-${arch})
     if (UNIX AND NOT ${arch} STREQUAL "i386")
       add_sanitizer_rt_symbols(clang_rt.ubsan-${arch} ubsan.syms.extra)
       add_sanitizer_rt_symbols(clang_rt.ubsan_cxx-${arch} ubsan.syms.extra)
-      list(APPEND UBSAN_RUNTIME_LIBRARIES
+      add_dependencies(ubsan
         clang_rt.ubsan-${arch}-symbols
         clang_rt.ubsan_cxx-${arch}-symbols)
     endif()
   endforeach()
 endif()
-
-if(UBSAN_SUPPORTED_ARCH)
-  add_subdirectory(lit_tests)
-endif()

Removed: compiler-rt/trunk/lib/ubsan/lit_tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/lit_tests/CMakeLists.txt?rev=201400&view=auto
==============================================================================
--- compiler-rt/trunk/lib/ubsan/lit_tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/ubsan/lit_tests/CMakeLists.txt (removed)
@@ -1,23 +0,0 @@
-set(UBSAN_LIT_TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR})
-
-configure_lit_site_cfg(
-  ${CMAKE_CURRENT_SOURCE_DIR}/UbsanConfig/lit.site.cfg.in
-  ${CMAKE_CURRENT_BINARY_DIR}/UbsanConfig/lit.site.cfg)
-
-configure_lit_site_cfg(
-  ${CMAKE_CURRENT_SOURCE_DIR}/AsanConfig/lit.site.cfg.in
-  ${CMAKE_CURRENT_BINARY_DIR}/AsanConfig/lit.site.cfg)
-
-if(COMPILER_RT_CAN_EXECUTE_TESTS)
-  # Run UBSan output tests only if we're sure that clang would produce
-  # working binaries.
-  set(UBSAN_TEST_DEPS
-    ${SANITIZER_COMMON_LIT_TEST_DEPS}
-    ${UBSAN_RUNTIME_LIBRARIES}
-    asan_runtime_libraries)
-  add_lit_testsuite(check-ubsan "Running UndefinedBehaviorSanitizer tests"
-    ${CMAKE_CURRENT_BINARY_DIR}/UbsanConfig
-    ${CMAKE_CURRENT_BINARY_DIR}/AsanConfig
-    DEPENDS ${UBSAN_TEST_DEPS})
-  set_target_properties(check-ubsan PROPERTIES FOLDER "UBSan unittests")
-endif()

Removed: compiler-rt/trunk/lib/ubsan/lit_tests/lit.common.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/lit_tests/lit.common.cfg?rev=201400&view=auto
==============================================================================
--- compiler-rt/trunk/lib/ubsan/lit_tests/lit.common.cfg (original)
+++ compiler-rt/trunk/lib/ubsan/lit_tests/lit.common.cfg (removed)
@@ -1,31 +0,0 @@
-# -*- Python -*-
-
-import os
-
-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 source root.
-ubsan_lit_tests_dir = get_required_attr(config, 'ubsan_lit_tests_dir')
-config.test_source_root = os.path.join(ubsan_lit_tests_dir, 'TestCases')
-
-def DisplayNoConfigMessage():
-  lit_config.fatal("No site specific configuration available! " +
-                   "Try running your test from the build tree or running " +
-                   "make check-ubsan")
-
-# Default test suffixes.
-config.suffixes = ['.c', '.cc', '.cpp']
-
-# UndefinedBehaviorSanitizer tests are currently supported on
-# Linux and Darwin only.
-if config.host_os not in ['Linux', 'Darwin']:
-  config.unsupported = True
-
-config.pipefail = False

Modified: compiler-rt/trunk/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/CMakeLists.txt?rev=201401&r1=201400&r2=201401&view=diff
==============================================================================
--- compiler-rt/trunk/test/CMakeLists.txt (original)
+++ compiler-rt/trunk/test/CMakeLists.txt Fri Feb 14 05:42:22 2014
@@ -5,3 +5,11 @@ configure_lit_site_cfg(
 # BlocksRuntime and builtins testsuites are not yet ported to lit.
 # add_subdirectory(BlocksRuntime)
 # add_subdirectory(builtins)
+
+# Run sanitizer tests only if we're sure that clang would produce
+# working binaries.
+if(COMPILER_RT_CAN_EXECUTE_TESTS)
+  if(UBSAN_SUPPORTED_ARCH)
+    add_subdirectory(ubsan)
+  endif()
+endif()

Modified: compiler-rt/trunk/test/ubsan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/ubsan/CMakeLists.txt?rev=201401&r1=201396&r2=201401&view=diff
==============================================================================
--- compiler-rt/trunk/test/ubsan/CMakeLists.txt (original)
+++ compiler-rt/trunk/test/ubsan/CMakeLists.txt Fri Feb 14 05:42:22 2014
@@ -8,16 +8,12 @@ configure_lit_site_cfg(
   ${CMAKE_CURRENT_SOURCE_DIR}/AsanConfig/lit.site.cfg.in
   ${CMAKE_CURRENT_BINARY_DIR}/AsanConfig/lit.site.cfg)
 
-if(COMPILER_RT_CAN_EXECUTE_TESTS)
-  # Run UBSan output tests only if we're sure that clang would produce
-  # working binaries.
-  set(UBSAN_TEST_DEPS
-    ${SANITIZER_COMMON_LIT_TEST_DEPS}
-    ${UBSAN_RUNTIME_LIBRARIES}
-    asan_runtime_libraries)
-  add_lit_testsuite(check-ubsan "Running UndefinedBehaviorSanitizer tests"
-    ${CMAKE_CURRENT_BINARY_DIR}/UbsanConfig
-    ${CMAKE_CURRENT_BINARY_DIR}/AsanConfig
-    DEPENDS ${UBSAN_TEST_DEPS})
-  set_target_properties(check-ubsan PROPERTIES FOLDER "UBSan unittests")
-endif()
+set(UBSAN_TEST_DEPS
+  ${SANITIZER_COMMON_LIT_TEST_DEPS}
+  ubsan
+  asan_runtime_libraries)
+add_lit_testsuite(check-ubsan "Running UndefinedBehaviorSanitizer tests"
+  ${CMAKE_CURRENT_BINARY_DIR}/UbsanConfig
+  ${CMAKE_CURRENT_BINARY_DIR}/AsanConfig
+  DEPENDS ${UBSAN_TEST_DEPS})
+set_target_properties(check-ubsan PROPERTIES FOLDER "UBSan unittests")





More information about the llvm-commits mailing list