[cross-project-tests] Make clang optional if not in LLVM_ENABLE_PROJECTS
authorJames Henderson <james.henderson@sony.com>
Tue, 9 Feb 2021 15:19:27 +0000 (15:19 +0000)
committerJames Henderson <james.henderson@sony.com>
Mon, 28 Jun 2021 10:31:40 +0000 (11:31 +0100)
Also mark debuginfo_tests as UNSUPPORTED if clang can't be found and
remove it from the list of test dependencies if not in
LLVM_ENABLE_PROJECTS.

Differential Revision: https://reviews.llvm.org/D96511

Reviewed by: aprantl

cross-project-tests/CMakeLists.txt
cross-project-tests/debuginfo-tests/lit.local.cfg [new file with mode: 0644]
cross-project-tests/lit.cfg.py

index 57bcc76..a4ae34d 100644 (file)
@@ -15,7 +15,6 @@ set(CROSS_PROJECT_TESTS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
 set(CROSS_PROJECT_TESTS_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
 
 set(CROSS_PROJECT_TEST_DEPS
-  clang
   FileCheck
   count
   llvm-config
@@ -24,6 +23,10 @@ set(CROSS_PROJECT_TEST_DEPS
   not
   )
 
+if ("clang" IN_LIST LLVM_ENABLE_PROJECTS)
+  list(APPEND CROSS_PROJECT_TEST_DEPS clang)
+endif()
+
 if ("mlir" IN_LIST LLVM_ENABLE_PROJECTS)
   add_llvm_executable(check-gdb-mlir-support
         debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp
diff --git a/cross-project-tests/debuginfo-tests/lit.local.cfg b/cross-project-tests/debuginfo-tests/lit.local.cfg
new file mode 100644 (file)
index 0000000..62f90a1
--- /dev/null
@@ -0,0 +1,2 @@
+if 'clang' not in config.available_features:
+    config.unsupported = True
index 2df478d..9af7361 100644 (file)
@@ -71,7 +71,8 @@ if is_msvc:
 # use_clang() and use_lld() respectively, so set them to "", if needed.
 if not hasattr(config, 'clang_src_dir'):
     config.clang_src_dir = ""
-llvm_config.use_clang()
+llvm_config.use_clang(required=('clang' in config.llvm_enabled_projects))
+
 if not hasattr(config, 'lld_src_dir'):
     config.lld_src_dir = ""
 llvm_config.use_lld(required=('lld' in config.llvm_enabled_projects))