]> git.proxmox.com Git - rustc.git/blobdiff - src/compiler-rt/test/CMakeLists.txt
Imported Upstream version 1.6.0+dfsg1
[rustc.git] / src / compiler-rt / test / CMakeLists.txt
index 847721635304f50e531def16dfc21a574922c27e..684b409bb8f72f7b3da67f2784d6e8bb629ffb7b 100644 (file)
@@ -7,14 +7,26 @@ configure_lit_site_cfg(
 # add_subdirectory(builtins)
 
 set(SANITIZER_COMMON_LIT_TEST_DEPS)
+if(COMPILER_RT_STANDALONE_BUILD)
+  add_executable(FileCheck IMPORTED GLOBAL)
+  set_property(TARGET FileCheck PROPERTY IMPORTED_LOCATION ${LLVM_TOOLS_BINARY_DIR}/FileCheck)
+  list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS FileCheck)
+endif()
+
 # When ANDROID, we build tests with the host compiler (i.e. CMAKE_C_COMPILER),
 # and run tests with tools from the host toolchain.
 if(NOT ANDROID)
   if(NOT COMPILER_RT_STANDALONE_BUILD)
     # Use LLVM utils and Clang from the same build tree.
     list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS
-      clang clang-headers FileCheck count not llvm-nm llvm-symbolizer
+      clang clang-headers FileCheck count not llvm-config llvm-nm llvm-symbolizer
       compiler-rt-headers)
+    if (COMPILER_RT_HAS_PROFILE)
+      list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS profile)
+    endif()
+    if (WIN32)
+      list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS KillTheDoctor)
+    endif()
   endif()
   if(UNIX)
     list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS SanitizerLintCheck)
@@ -24,30 +36,37 @@ endif()
 # Run sanitizer tests only if we're sure that clang would produce
 # working binaries.
 if(COMPILER_RT_CAN_EXECUTE_TESTS)
-  if(ASAN_SUPPORTED_ARCH OR ANDROID)
+  if(COMPILER_RT_HAS_ASAN)
     add_subdirectory(asan)
   endif()
-  if(DFSAN_SUPPORTED_ARCH)
+  if(COMPILER_RT_HAS_DFSAN)
     add_subdirectory(dfsan)
   endif()
-  if(LSAN_SUPPORTED_ARCH)
+  if(COMPILER_RT_HAS_LSAN)
     add_subdirectory(lsan)
   endif()
-  if(MSAN_SUPPORTED_ARCH)
+  if(COMPILER_RT_HAS_MSAN)
     add_subdirectory(msan)
   endif()
-  if(PROFILE_SUPPORTED_ARCH)
+  if(COMPILER_RT_HAS_PROFILE)
     add_subdirectory(profile)
   endif()
-  if(SANITIZER_COMMON_SUPPORTED_ARCH)
+  if(COMPILER_RT_HAS_SANITIZER_COMMON)
     add_subdirectory(sanitizer_common)
   endif()
-  if(TSAN_SUPPORTED_ARCH)
+  if(COMPILER_RT_HAS_TSAN)
     add_subdirectory(tsan)
   endif()
-  if(UBSAN_SUPPORTED_ARCH)
+  if(COMPILER_RT_HAS_UBSAN)
     add_subdirectory(ubsan)
   endif()
+  # CFI tests require diagnostic mode, which is implemented in UBSan.
+  if(COMPILER_RT_HAS_UBSAN)
+    add_subdirectory(cfi)
+  endif()
+  if(COMPILER_RT_HAS_SAFESTACK)
+    add_subdirectory(safestack)
+  endif()
 endif()
 
 if(COMPILER_RT_STANDALONE_BUILD)