[PATCH] D96511: [cross-project-tests] Make clang optional if not in LLVM_ENABLE_PROJECTS

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 11 07:48:05 PST 2021


jhenderson created this revision.
jhenderson added reviewers: aprantl, aganea, dblaikie, jmorse, rnk, Orlando.
Herald added a subscriber: mgorny.
jhenderson requested review of this revision.
Herald added a project: LLVM.

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.

Depends on D96510 <https://reviews.llvm.org/D96510>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96511

Files:
  cross-project-tests/CMakeLists.txt
  cross-project-tests/debuginfo-tests/lit.local.cfg
  cross-project-tests/lit.cfg.py


Index: cross-project-tests/lit.cfg.py
===================================================================
--- cross-project-tests/lit.cfg.py
+++ cross-project-tests/lit.cfg.py
@@ -71,7 +71,12 @@
 # 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 llvm_config.config.clang:
+    llvm_config.with_environment('PATHTOCLANG', llvm_config.config.clang)
+    llvm_config.with_environment('PATHTOCLANGPP', llvm_config.use_llvm_tool('clang++'))
+    llvm_config.with_environment('PATHTOCLANGCL', llvm_config.use_llvm_tool('clang-cl'))
+
 if 'lld' in config.llvm_enabled_projects:
     if not hasattr(config, 'lld_src_dir'):
         config.lld_src_dir = ""
@@ -81,9 +86,6 @@
     # Propagate path to symbolizer for ASan/MSan.
     llvm_config.with_system_environment(
         ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH'])
-llvm_config.with_environment('PATHTOCLANG', llvm_config.config.clang)
-llvm_config.with_environment('PATHTOCLANGPP', llvm_config.use_llvm_tool('clang++'))
-llvm_config.with_environment('PATHTOCLANGCL', llvm_config.use_llvm_tool('clang-cl'))
 
 # Check which debuggers are available:
 built_lldb = llvm_config.use_llvm_tool('lldb', search_env='CLANG')
Index: cross-project-tests/debuginfo-tests/lit.local.cfg
===================================================================
--- /dev/null
+++ cross-project-tests/debuginfo-tests/lit.local.cfg
@@ -0,0 +1,2 @@
+if 'clang' not in config.available_features:
+    config.unsupported = True
Index: cross-project-tests/CMakeLists.txt
===================================================================
--- cross-project-tests/CMakeLists.txt
+++ cross-project-tests/CMakeLists.txt
@@ -15,7 +15,6 @@
 set(CROSS_PROJECT_TESTS_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
 
 set(CROSS_PROJECT_TEST_DEPS
-  clang
   FileCheck
   count
   llvm-config
@@ -24,6 +23,10 @@
   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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96511.323015.patch
Type: text/x-patch
Size: 2290 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210211/0000f2c5/attachment.bin>


More information about the llvm-commits mailing list