https://github.com/kastiglione updated https://github.com/llvm/llvm-project/pull/181720
>From 905b7d361622583998ade3d7e978b5d89fe29bdb Mon Sep 17 00:00:00 2001 From: Dave Lee <[email protected]> Date: Mon, 16 Feb 2026 10:33:05 -0800 Subject: [PATCH 1/2] [lldb] Allow tests to share a single build This allows a test to have a single shared build for the test case, instead of the default behavior of a separate build for each test function. Concretely, this results in a single build directory, named by the test. The default behavior is to create many build directories, named `TestSomething.test_one`, `TestSomething.test_two`, etc. This is opt-in, tests get a single shared build by setting `SHARED_BUILD_TESTCASE` in the test case class. The goal here is to make the test suite eventually more efficient, by not repeatedly building the same test source. --- lldb/packages/Python/lldbsuite/test/lldbtest.py | 7 ++++++- lldb/test/API/commands/dwim-print/TestDWIMPrint.py | 2 ++ .../test/API/commands/dwim-print/objc/TestDWIMPrintObjC.py | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py index 6034eca3b93f2..c8a69142394ee 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py +++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -569,6 +569,8 @@ class Base(unittest.TestCase): # Can be overridden by the LLDB_TIME_WAIT_NEXT_LAUNCH environment variable. timeWaitNextLaunch = 1.0 + SHARED_BUILD_TESTCASE = False + @staticmethod def compute_mydir(test_file): """Subclasses should call this function to correctly calculate the @@ -754,7 +756,10 @@ def getSourceDir(self): return os.path.join(configuration.test_src_root, self.mydir) def getBuildDirBasename(self): - return self.__class__.__module__ + "." + self.testMethodName + if self.__class__.SHARED_BUILD_TESTCASE: + return self.__class__.__module__ + else: + return self.__class__.__module__ + "." + self.testMethodName def getBuildDir(self): """Return the full path to the current test.""" diff --git a/lldb/test/API/commands/dwim-print/TestDWIMPrint.py b/lldb/test/API/commands/dwim-print/TestDWIMPrint.py index 82ff59f74f41f..694671faedfc2 100644 --- a/lldb/test/API/commands/dwim-print/TestDWIMPrint.py +++ b/lldb/test/API/commands/dwim-print/TestDWIMPrint.py @@ -10,6 +10,8 @@ class TestCase(TestBase): + SHARED_BUILD_TESTCASE = True + def _run_cmd(self, cmd: str) -> str: """Run the given lldb command and return its output.""" result = lldb.SBCommandReturnObject() diff --git a/lldb/test/API/commands/dwim-print/objc/TestDWIMPrintObjC.py b/lldb/test/API/commands/dwim-print/objc/TestDWIMPrintObjC.py index 616d049459ab9..0a863c85bbc69 100644 --- a/lldb/test/API/commands/dwim-print/objc/TestDWIMPrintObjC.py +++ b/lldb/test/API/commands/dwim-print/objc/TestDWIMPrintObjC.py @@ -9,6 +9,8 @@ class TestCase(TestBase): + SHARED_BUILD_TESTCASE = True + @skipUnlessDarwin def test(self): self.build() >From c70fe1576c372e5d115516f44de36ddc1223b94c Mon Sep 17 00:00:00 2001 From: Dave Lee <[email protected]> Date: Mon, 16 Feb 2026 10:44:21 -0800 Subject: [PATCH 2/2] Add comment doc --- lldb/packages/Python/lldbsuite/test/lldbtest.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py index c8a69142394ee..404074bea5964 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py +++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -569,6 +569,8 @@ class Base(unittest.TestCase): # Can be overridden by the LLDB_TIME_WAIT_NEXT_LAUNCH environment variable. timeWaitNextLaunch = 1.0 + # Subclasses can set this to True to avoid repeated building of the test + # source (by default, a separate build happens for each test function). SHARED_BUILD_TESTCASE = False @staticmethod _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
