[Lldb-commits] [lldb] [lldb][test] Don't print LLDB version in every test (PR #201307)
via lldb-commits
lldb-commits at lists.llvm.org
Wed Jun 3 03:23:47 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Raphael Isemann (Teemperor)
<details>
<summary>Changes</summary>
An empty minimal API test currently runs for 330ms on my macOS system. Of these 330ms, we spend 70ms (20%) just to print the lldb version number at the start of each test.
This patch disables this behavior by default and instead prints the LLDB version number once at the start of the LIT test suite. This saves about 2 minutes of CPU time in an LLDB test suite run.
---
Full diff: https://github.com/llvm/llvm-project/pull/201307.diff
4 Files Affected:
- (modified) lldb/packages/Python/lldbsuite/test/configuration.py (+3)
- (modified) lldb/packages/Python/lldbsuite/test/dotest.py (+5-1)
- (modified) lldb/packages/Python/lldbsuite/test/dotest_args.py (+6)
- (modified) lldb/test/API/lit.cfg.py (+14)
``````````diff
diff --git a/lldb/packages/Python/lldbsuite/test/configuration.py b/lldb/packages/Python/lldbsuite/test/configuration.py
index d1c933b35fcdf..8347565dc26a4 100644
--- a/lldb/packages/Python/lldbsuite/test/configuration.py
+++ b/lldb/packages/Python/lldbsuite/test/configuration.py
@@ -154,6 +154,9 @@
# Whether debugserver is built with arm64e support.
arm64e_debugserver = False
+# Whether to print the lldb version banner during test setup.
+print_lldb_version = False
+
# the build type of lldb
# Typical values include Debug, Release, RelWithDebInfo and MinSizeRel
cmake_build_type = None
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py
index 888d980e398d3..252d02c9b6d72 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -472,6 +472,9 @@ def parseOptionsAndInitTestdirs():
if args.arm64e_debugserver:
configuration.arm64e_debugserver = True
+ if args.print_lldb_version:
+ configuration.print_lldb_version = True
+
# Gather all the dirs passed on the command line.
if len(args.args) > 0:
configuration.testdirs = [
@@ -568,7 +571,8 @@ def setupSysPath():
)
sys.exit(-1)
- os.system("%s -v" % lldbtest_config.lldbExec)
+ if configuration.print_lldb_version:
+ os.system("%s -v" % lldbtest_config.lldbExec)
lldbDir = os.path.dirname(lldbtest_config.lldbExec)
diff --git a/lldb/packages/Python/lldbsuite/test/dotest_args.py b/lldb/packages/Python/lldbsuite/test/dotest_args.py
index f3b0837bdc4ab..8ccca84cefdc2 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest_args.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest_args.py
@@ -281,6 +281,12 @@ def create_parser():
action="store_true",
help="Indicate that debugserver is built with arm64e support.",
)
+ group.add_argument(
+ "--print-lldb-version",
+ dest="print_lldb_version",
+ action="store_false",
+ help="Print the lldb version banner during test setup.",
+ )
# Configuration options
group = parser.add_argument_group("Remote platform options")
diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py
index 2662a77199641..930f1b40f309a 100644
--- a/lldb/test/API/lit.cfg.py
+++ b/lldb/test/API/lit.cfg.py
@@ -255,6 +255,20 @@ def delete_module_cache(path):
if is_configured("lldb_executable"):
dotest_cmd += ["--executable", config.lldb_executable]
+ try:
+ version_output = subprocess.check_output(
+ [config.lldb_executable, "--version"],
+ stderr=subprocess.STDOUT,
+ text=True,
+ ).strip()
+ for line in version_output.splitlines():
+ lit_config.note(line.strip())
+ except (subprocess.CalledProcessError, OSError) as e:
+ lit_config.warning(
+ "Could not get lldb version from {}: {}".format(
+ config.lldb_executable, e
+ )
+ )
if is_configured("test_compiler"):
dotest_cmd += ["--compiler", config.test_compiler]
``````````
</details>
https://github.com/llvm/llvm-project/pull/201307
More information about the lldb-commits
mailing list