[Lldb-commits] [lldb] e9f292c - [lldb][test] Don't print LLDB version in every test (#201307)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Jun 8 02:40:54 PDT 2026
Author: Raphael Isemann
Date: 2026-06-08T10:40:50+01:00
New Revision: e9f292cef075da614125721bb9fa542e2db8a192
URL: https://github.com/llvm/llvm-project/commit/e9f292cef075da614125721bb9fa542e2db8a192
DIFF: https://github.com/llvm/llvm-project/commit/e9f292cef075da614125721bb9fa542e2db8a192.diff
LOG: [lldb][test] Don't print LLDB version in every test (#201307)
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.
Added:
Modified:
lldb/packages/Python/lldbsuite/test/configuration.py
lldb/packages/Python/lldbsuite/test/dotest.py
lldb/packages/Python/lldbsuite/test/dotest_args.py
lldb/test/API/lit.cfg.py
Removed:
################################################################################
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..c9d91718b3339 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_true",
+ 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 d1a28a842371b..ac2301b361da2 100644
--- a/lldb/test/API/lit.cfg.py
+++ b/lldb/test/API/lit.cfg.py
@@ -259,6 +259,18 @@ 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]
More information about the lldb-commits
mailing list