Skip to content

Commit da83f36

Browse files
Reapply "[clangd] Enable lit internal shell by default"
This reverts commit 4cfbc44. This was failing due to a missing chmod binary on one of the bots (clangd-ubuntu-tsan). This patch fixes that by explicitly checking for the presence of a chmod binary. This should not be necessary (I have added a TODO for myself to update once I have looked at the bot setup which I am currently waiting on access to) as check-llvm works with requiring chmod unconditionally.
1 parent e6ae246 commit da83f36

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

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

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
1+
import os
2+
import shutil
3+
14
import lit.llvm
25
import lit.util
36

47
lit.llvm.initialize(lit_config, config)
58
lit.llvm.llvm_config.clang_setup()
69
lit.llvm.llvm_config.use_default_substitutions()
710

11+
# TODO: Consolidate the logic for turning on the internal shell by default for all LLVM test suites.
12+
# See https://github.com/llvm/llvm-project/issues/106636 for more details.
13+
#
14+
# We prefer the lit internal shell which provides a better user experience on failures
15+
# and is faster unless the user explicitly disables it with LIT_USE_INTERNAL_SHELL=0
16+
# env var.
17+
use_lit_shell = True
18+
lit_shell_env = os.environ.get("LIT_USE_INTERNAL_SHELL")
19+
if lit_shell_env:
20+
use_lit_shell = lit.util.pythonize_bool(lit_shell_env)
21+
822
config.name = "Clangd"
923
config.suffixes = [".test"]
1024
config.excludes = ["Inputs"]
11-
config.test_format = lit.formats.ShTest(not lit.llvm.llvm_config.use_lit_shell)
25+
config.test_format = lit.formats.ShTest(not use_lit_shell)
1226
config.test_source_root = config.clangd_source_dir + "/test"
1327
config.test_exec_root = config.clangd_binary_dir + "/test"
1428

@@ -41,6 +55,13 @@ def calculate_arch_features(arch_string):
4155
if lit.util.pythonize_bool(config.have_benchmarks):
4256
config.available_features.add("have-benchmarks")
4357

58+
# This is needed to avoid running a single test (system-include-extractor.test)
59+
# on a single buildbot (clangd-ubuntu-tsan) and likely should not be needed. We
60+
# are able to unconditionally assume a chmod binary exists for check-llvm.
61+
# TODO(boomanaiden154): Fix this after investigating the bot setup.
62+
if shutil.which("chmod"):
63+
config.available_features.add("chmod")
64+
4465
# It is not realistically possible to account for all options that could
4566
# possibly be present in system and user configuration files, so disable
4667
# default configs for the test runs.

clang-tools-extra/clangd/test/system-include-extractor.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# RUN: rm -rf %t.dir && mkdir -p %t.dir
22

33
# The mock driver below is a shell script:
4-
# REQUIRES: shell
4+
# REQUIRES: shell, chmod
55

66
# Create a bin directory to store the mock-driver and add it to the path
77
# RUN: mkdir -p %t.dir/bin

0 commit comments

Comments
 (0)