Move UBSan test suite under test/
authorAlexey Samsonov <samsonov@google.com>
Fri, 14 Feb 2014 11:42:22 +0000 (11:42 +0000)
committerAlexey Samsonov <samsonov@google.com>
Fri, 14 Feb 2014 11:42:22 +0000 (11:42 +0000)
llvm-svn: 201401

36 files changed:
compiler-rt/CMakeLists.txt
compiler-rt/lib/ubsan/CMakeLists.txt
compiler-rt/lib/ubsan/lit_tests/CMakeLists.txt [deleted file]
compiler-rt/test/CMakeLists.txt
compiler-rt/test/ubsan/AsanConfig/lit.cfg [moved from compiler-rt/lib/ubsan/lit_tests/AsanConfig/lit.cfg with 100% similarity]
compiler-rt/test/ubsan/AsanConfig/lit.site.cfg.in [moved from compiler-rt/lib/ubsan/lit_tests/AsanConfig/lit.site.cfg.in with 100% similarity]
compiler-rt/test/ubsan/CMakeLists.txt [new file with mode: 0644]
compiler-rt/test/ubsan/TestCases/Float/cast-overflow.cpp [moved from compiler-rt/lib/ubsan/lit_tests/TestCases/Float/cast-overflow.cpp with 100% similarity]
compiler-rt/test/ubsan/TestCases/Integer/add-overflow.cpp [moved from compiler-rt/lib/ubsan/lit_tests/TestCases/Integer/add-overflow.cpp with 100% similarity]
compiler-rt/test/ubsan/TestCases/Integer/div-overflow.cpp [moved from compiler-rt/lib/ubsan/lit_tests/TestCases/Integer/div-overflow.cpp with 100% similarity]
compiler-rt/test/ubsan/TestCases/Integer/div-zero.cpp [moved from compiler-rt/lib/ubsan/lit_tests/TestCases/Integer/div-zero.cpp with 100% similarity]
compiler-rt/test/ubsan/TestCases/Integer/incdec-overflow.cpp [moved from compiler-rt/lib/ubsan/lit_tests/TestCases/Integer/incdec-overflow.cpp with 100% similarity]
compiler-rt/test/ubsan/TestCases/Integer/mul-overflow.cpp [moved from compiler-rt/lib/ubsan/lit_tests/TestCases/Integer/mul-overflow.cpp with 100% similarity]
compiler-rt/test/ubsan/TestCases/Integer/negate-overflow.cpp [moved from compiler-rt/lib/ubsan/lit_tests/TestCases/Integer/negate-overflow.cpp with 100% similarity]
compiler-rt/test/ubsan/TestCases/Integer/no-recover.cpp [moved from compiler-rt/lib/ubsan/lit_tests/TestCases/Integer/no-recover.cpp with 100% similarity]
compiler-rt/test/ubsan/TestCases/Integer/shift.cpp [moved from compiler-rt/lib/ubsan/lit_tests/TestCases/Integer/shift.cpp with 100% similarity]
compiler-rt/test/ubsan/TestCases/Integer/sub-overflow.cpp [moved from compiler-rt/lib/ubsan/lit_tests/TestCases/Integer/sub-overflow.cpp with 100% similarity]
compiler-rt/test/ubsan/TestCases/Integer/uadd-overflow.cpp [moved from compiler-rt/lib/ubsan/lit_tests/TestCases/Integer/uadd-overflow.cpp with 100% similarity]
compiler-rt/test/ubsan/TestCases/Integer/uincdec-overflow.cpp [moved from compiler-rt/lib/ubsan/lit_tests/TestCases/Integer/uincdec-overflow.cpp with 100% similarity]
compiler-rt/test/ubsan/TestCases/Integer/umul-overflow.cpp [moved from compiler-rt/lib/ubsan/lit_tests/TestCases/Integer/umul-overflow.cpp with 100% similarity]
compiler-rt/test/ubsan/TestCases/Integer/usub-overflow.cpp [moved from compiler-rt/lib/ubsan/lit_tests/TestCases/Integer/usub-overflow.cpp with 100% similarity]
compiler-rt/test/ubsan/TestCases/Misc/bool.cpp [moved from compiler-rt/lib/ubsan/lit_tests/TestCases/Misc/bool.cpp with 100% similarity]
compiler-rt/test/ubsan/TestCases/Misc/bounds.cpp [moved from compiler-rt/lib/ubsan/lit_tests/TestCases/Misc/bounds.cpp with 100% similarity]
compiler-rt/test/ubsan/TestCases/Misc/deduplication.cpp [moved from compiler-rt/lib/ubsan/lit_tests/TestCases/Misc/deduplication.cpp with 100% similarity]
compiler-rt/test/ubsan/TestCases/Misc/enum.cpp [moved from compiler-rt/lib/ubsan/lit_tests/TestCases/Misc/enum.cpp with 100% similarity]
compiler-rt/test/ubsan/TestCases/Misc/missing_return.cpp [moved from compiler-rt/lib/ubsan/lit_tests/TestCases/Misc/missing_return.cpp with 100% similarity]
compiler-rt/test/ubsan/TestCases/Misc/unreachable.cpp [moved from compiler-rt/lib/ubsan/lit_tests/TestCases/Misc/unreachable.cpp with 100% similarity]
compiler-rt/test/ubsan/TestCases/Misc/vla.c [moved from compiler-rt/lib/ubsan/lit_tests/TestCases/Misc/vla.c with 100% similarity]
compiler-rt/test/ubsan/TestCases/TypeCheck/Function/function.cpp [moved from compiler-rt/lib/ubsan/lit_tests/TestCases/TypeCheck/Function/function.cpp with 100% similarity]
compiler-rt/test/ubsan/TestCases/TypeCheck/Function/lit.local.cfg [moved from compiler-rt/lib/ubsan/lit_tests/TestCases/TypeCheck/Function/lit.local.cfg with 100% similarity]
compiler-rt/test/ubsan/TestCases/TypeCheck/misaligned.cpp [moved from compiler-rt/lib/ubsan/lit_tests/TestCases/TypeCheck/misaligned.cpp with 100% similarity]
compiler-rt/test/ubsan/TestCases/TypeCheck/null.cpp [moved from compiler-rt/lib/ubsan/lit_tests/TestCases/TypeCheck/null.cpp with 100% similarity]
compiler-rt/test/ubsan/TestCases/TypeCheck/vptr.cpp [moved from compiler-rt/lib/ubsan/lit_tests/TestCases/TypeCheck/vptr.cpp with 100% similarity]
compiler-rt/test/ubsan/UbsanConfig/lit.cfg [moved from compiler-rt/lib/ubsan/lit_tests/UbsanConfig/lit.cfg with 100% similarity]
compiler-rt/test/ubsan/UbsanConfig/lit.site.cfg.in [moved from compiler-rt/lib/ubsan/lit_tests/UbsanConfig/lit.site.cfg.in with 100% similarity]
compiler-rt/test/ubsan/lit.common.cfg [moved from compiler-rt/lib/ubsan/lit_tests/lit.common.cfg with 100% similarity]

index 97cd614..c8aa9c8 100644 (file)
@@ -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)
 
index 78460da..a74cb93 100644 (file)
@@ -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()
diff --git a/compiler-rt/lib/ubsan/lit_tests/CMakeLists.txt b/compiler-rt/lib/ubsan/lit_tests/CMakeLists.txt
deleted file mode 100644 (file)
index 36d8dc1..0000000
+++ /dev/null
@@ -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()
index 1ab0cb5..b497550 100644 (file)
@@ -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()
diff --git a/compiler-rt/test/ubsan/CMakeLists.txt b/compiler-rt/test/ubsan/CMakeLists.txt
new file mode 100644 (file)
index 0000000..1ae2b87
--- /dev/null
@@ -0,0 +1,19 @@
+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)
+
+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")