[compiler-rt] [llvm] [lit] [compiler-rt] Add llvm-lit global command cache to speed up test config (PR #195888)
via llvm-commits
llvm-commits at lists.llvm.org
Tue May 5 10:41:52 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r origin/main...HEAD compiler-rt/test/lit.common.cfg.py llvm/utils/lit/lit/util.py
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- compiler-rt/test/lit.common.cfg.py 2026-05-05 17:38:31.000000 +0000
+++ compiler-rt/test/lit.common.cfg.py 2026-05-05 17:41:12.576272 +0000
@@ -579,11 +579,13 @@
else:
# There is no simulator-specific sw_vers/sysctl, so we use the host OS version
os_detection_prefix = []
darwin_os_version = lit.util.runCommandCached(
- os_detection_prefix + ["sw_vers", "-productVersion"], universal_newlines=True, text=True
+ os_detection_prefix + ["sw_vers", "-productVersion"],
+ universal_newlines=True,
+ text=True,
)
darwin_os_version = tuple(int(x) for x in darwin_os_version.strip().split("."))
if len(darwin_os_version) == 2:
darwin_os_version = (darwin_os_version[0], darwin_os_version[1], 0)
@@ -941,11 +943,13 @@
config.default_sanitizer_opts += ["abort_on_error=0"]
config.default_sanitizer_opts += ["log_to_syslog=0"]
if lit.util.which("log"):
# Querying the log can only done by a privileged user so
# so check if we can query the log.
- res = lit.util.runCommandCached(["log", "show", "--last", "1m", "--predicate", "1 == 0"], allow_failure=True)
+ res = lit.util.runCommandCached(
+ ["log", "show", "--last", "1m", "--predicate", "1 == 0"], allow_failure=True
+ )
if res is not None:
config.available_features.add("darwin_log_cmd")
else:
lit_config.warning("log command not found. Some tests will be skipped.")
elif config.android:
--- llvm/utils/lit/lit/util.py 2026-05-05 17:38:31.000000 +0000
+++ llvm/utils/lit/lit/util.py 2026-05-05 17:41:12.693762 +0000
@@ -440,10 +440,11 @@
pass
psutilProc.kill()
except psutil.NoSuchProcess:
pass
+
@functools.cache
def _runCommandCachedInner(cmd, allow_failure, **kwargs):
try:
result = subprocess.run(
cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True, **kwargs
@@ -455,10 +456,11 @@
lit_config.warning(msg)
else:
lit_config.fatal(msg)
return None
+
def runCommandCached(cmd, allow_failure=False, **kwargs):
if type(cmd) is list:
cmd = tuple(cmd)
elif type(cmd) is str:
cmd = tuple([cmd])
``````````
</details>
https://github.com/llvm/llvm-project/pull/195888
More information about the llvm-commits
mailing list