| 1 |
import os |
| 2 |
|
| 3 |
import lit.llvm |
| 4 |
import lit.util |
| 5 |
|
| 6 |
lit.llvm.initialize(lit_config, config) |
| 7 |
lit.llvm.llvm_config.clang_setup() |
| 8 |
lit.llvm.llvm_config.use_default_substitutions() |
| 9 |
|
| 10 |
# TODO: Consolidate the logic for turning on the internal shell by default for all LLVM test suites. |
| 11 |
# See https://github.com/llvm/llvm-project/issues/106636 for more details. |
| 12 |
# |
| 13 |
# We prefer the lit internal shell which provides a better user experience on failures |
| 14 |
# and is faster unless the user explicitly disables it with LIT_USE_INTERNAL_SHELL=0 |
| 15 |
# env var. |
| 16 |
use_lit_shell = True |
| 17 |
lit_shell_env = os.environ.get("LIT_USE_INTERNAL_SHELL") |
| 18 |
if lit_shell_env: |
| 19 |
use_lit_shell = lit.util.pythonize_bool(lit_shell_env) |
| 20 |
|
| 21 |
config.name = "Clangd" |
| 22 |
config.suffixes = [".test"] |
| 23 |
config.excludes = ["Inputs"] |
| 24 |
config.test_format = lit.formats.ShTest(not use_lit_shell) |
| 25 |
config.test_source_root = config.clangd_source_dir + "/test" |
| 26 |
config.test_exec_root = config.clangd_binary_dir + "/test" |
| 27 |
|
| 28 |
|
| 29 |
# Used to enable tests based on the required targets. Can be queried with e.g. |
| 30 |
# REQUIRES: x86-registered-target |
| 31 |
def calculate_arch_features(arch_string): |
| 32 |
return [arch.lower() + "-registered-target" for arch in arch_string.split()] |
| 33 |
|
| 34 |
|
| 35 |
lit.llvm.llvm_config.feature_config([("--targets-built", calculate_arch_features)]) |
| 36 |
|
| 37 |
# Clangd-specific lit environment. |
| 38 |
config.substitutions.append( |
| 39 |
("%clangd-benchmark-dir", config.clangd_binary_dir + "/benchmarks") |
| 40 |
) |
| 41 |
|
| 42 |
if config.clangd_build_xpc: |
| 43 |
config.available_features.add("clangd-xpc-support") |
| 44 |
|
| 45 |
if config.clangd_enable_remote: |
| 46 |
config.available_features.add("clangd-remote-index") |
| 47 |
|
| 48 |
if config.clangd_tidy_checks: |
| 49 |
config.available_features.add("clangd-tidy-checks") |
| 50 |
|
| 51 |
if config.have_zlib: |
| 52 |
config.available_features.add("zlib") |
| 53 |
|
| 54 |
if lit.util.pythonize_bool(config.have_benchmarks): |
| 55 |
config.available_features.add("have-benchmarks") |
| 56 |
|
| 57 |
# It is not realistically possible to account for all options that could |
| 58 |
# possibly be present in system and user configuration files, so disable |
| 59 |
# default configs for the test runs. |
| 60 |
config.environment["CLANG_NO_DEFAULT_CONFIG"] = "1" |