[clang-tools-extra] d34a91a - [clangd][test] Provide registered targets to lit tests

Kadir Cetinkaya via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 11 13:06:49 PDT 2020


Author: Kadir Cetinkaya
Date: 2020-04-11T22:03:08+02:00
New Revision: d34a91a10f7a25e3046f2d74df830a77ef81aebb

URL: https://github.com/llvm/llvm-project/commit/d34a91a10f7a25e3046f2d74df830a77ef81aebb
DIFF: https://github.com/llvm/llvm-project/commit/d34a91a10f7a25e3046f2d74df830a77ef81aebb.diff

LOG: [clangd][test] Provide registered targets to lit tests

Summary:
We had tests in clangd (target_info.test) that got enabled only on
systems that know about x86. But they were always disabled as clangd lit config
never registered those targets.

This patch adds those targets as `$TARGET$-registered-target`

Reviewers: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

Added: 
    

Modified: 
    clang-tools-extra/clangd/test/lit.cfg.py

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/test/lit.cfg.py b/clang-tools-extra/clangd/test/lit.cfg.py
index 5030ca356ef8..93e4463450e5 100644
--- a/clang-tools-extra/clangd/test/lit.cfg.py
+++ b/clang-tools-extra/clangd/test/lit.cfg.py
@@ -10,10 +10,19 @@
 config.test_source_root = config.clangd_source_dir + "/test"
 config.test_exec_root = config.clangd_binary_dir + "/test"
 
+
+# Used to enable tests based on the required targets. Can be queried with e.g.
+#    REQUIRES: x86-registered-target
+def calculate_arch_features(arch_string):
+  return [arch.lower() + '-registered-target' for arch in arch_string.split()]
+
+
+lit.llvm.llvm_config.feature_config([('--targets-built',
+                                      calculate_arch_features)])
+
 # Clangd-specific lit environment.
 config.substitutions.append(('%clangd-benchmark-dir',
                              config.clangd_binary_dir + "/benchmarks"))
 
 if config.clangd_build_xpc:
   config.available_features.add('clangd-xpc-support')
-


        


More information about the cfe-commits mailing list