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 2662a77199641..93091f6035e48 100644 --- a/lldb/test/API/lit.cfg.py +++ b/lldb/test/API/lit.cfg.py @@ -255,6 +255,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]