[Lldb-commits] [lldb] [lldb][NFC] Split up TestMultithreaded.py (PR #231856)

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 14 03:51:56 PDT 2026


https://github.com/Teemperor created https://github.com/llvm/llvm-project/pull/231856

This splits the big and slow TestMultithreaded test into several smaller tests. This allows running subtests in parallel.

It also makes it more obvious which of the subtests is flakey as the test sometimes hangs on the bots without any output.

>From 82c52c44ad159352b48318e9742b7ee8c3cdcfe3 Mon Sep 17 00:00:00 2001
From: Raphael Isemann <rise at apple.com>
Date: Wed, 14 Oct 2026 10:17:07 +0100
Subject: [PATCH] [lldb][NFC] Split up TestMultithreaded.py

This splits the big and slow TestMultithreaded test into several smaller
tests. This allows running subtests in parallel.

It also makes it more obvious which of the subtests is flakey as the
test sometimes hangs on the bots without any output.
---
 .../Python/lldbsuite/test/lldbtest.py         |  22 ++++
 lldb/test/API/api/multithreaded/Makefile      |   4 -
 .../api/multithreaded/TestMultithreaded.py    | 124 ------------------
 .../breakpoint_callback/Makefile              |   8 ++
 .../TestMultithreadedBreakpointCallback.py    |  18 +++
 .../test_breakpoint_callback.cpp              |   0
 .../breakpoint_location_callback/Makefile     |   8 ++
 ...MultithreadedBreakpointLocationCallback.py |  19 +++
 .../test_breakpoint_location_callback.cpp     |   0
 .../multithreaded/concurrent_unwind/Makefile  |   8 ++
 .../TestMultithreadedConcurrentUnwind.py      |  18 +++
 .../{ => concurrent_unwind}/deep_stack.cpp    |   0
 .../test_concurrent_unwind.cpp                |   0
 .../listener_event_description/Makefile       |   8 ++
 ...stMultithreadedListenerEventDescription.py |  20 +++
 .../test_listener_event_description.cpp       |   0
 .../listener_event_process_state/Makefile     |   8 ++
 ...tMultithreadedListenerEventProcessState.py |  20 +++
 .../test_listener_event_process_state.cpp     |   0
 .../multithreaded/listener_resume/Makefile    |   8 ++
 .../TestMultithreadedListenerResume.py        |  21 +++
 .../test_listener_resume.cpp                  |   0
 .../API/api/multithreaded/stop_hook/Makefile  |   8 ++
 .../stop_hook/TestMultithreadedStopHook.py    |  19 +++
 .../multithreaded/{ => stop_hook}/some_cmd.py |   0
 .../{ => stop_hook}/test_stop-hook.cpp        |   0
 26 files changed, 213 insertions(+), 128 deletions(-)
 delete mode 100644 lldb/test/API/api/multithreaded/Makefile
 delete mode 100644 lldb/test/API/api/multithreaded/TestMultithreaded.py
 create mode 100644 lldb/test/API/api/multithreaded/breakpoint_callback/Makefile
 create mode 100644 lldb/test/API/api/multithreaded/breakpoint_callback/TestMultithreadedBreakpointCallback.py
 rename lldb/test/API/api/multithreaded/{ => breakpoint_callback}/test_breakpoint_callback.cpp (100%)
 create mode 100644 lldb/test/API/api/multithreaded/breakpoint_location_callback/Makefile
 create mode 100644 lldb/test/API/api/multithreaded/breakpoint_location_callback/TestMultithreadedBreakpointLocationCallback.py
 rename lldb/test/API/api/multithreaded/{ => breakpoint_location_callback}/test_breakpoint_location_callback.cpp (100%)
 create mode 100644 lldb/test/API/api/multithreaded/concurrent_unwind/Makefile
 create mode 100644 lldb/test/API/api/multithreaded/concurrent_unwind/TestMultithreadedConcurrentUnwind.py
 rename lldb/test/API/api/multithreaded/{ => concurrent_unwind}/deep_stack.cpp (100%)
 rename lldb/test/API/api/multithreaded/{ => concurrent_unwind}/test_concurrent_unwind.cpp (100%)
 create mode 100644 lldb/test/API/api/multithreaded/listener_event_description/Makefile
 create mode 100644 lldb/test/API/api/multithreaded/listener_event_description/TestMultithreadedListenerEventDescription.py
 rename lldb/test/API/api/multithreaded/{ => listener_event_description}/test_listener_event_description.cpp (100%)
 create mode 100644 lldb/test/API/api/multithreaded/listener_event_process_state/Makefile
 create mode 100644 lldb/test/API/api/multithreaded/listener_event_process_state/TestMultithreadedListenerEventProcessState.py
 rename lldb/test/API/api/multithreaded/{ => listener_event_process_state}/test_listener_event_process_state.cpp (100%)
 create mode 100644 lldb/test/API/api/multithreaded/listener_resume/Makefile
 create mode 100644 lldb/test/API/api/multithreaded/listener_resume/TestMultithreadedListenerResume.py
 rename lldb/test/API/api/multithreaded/{ => listener_resume}/test_listener_resume.cpp (100%)
 create mode 100644 lldb/test/API/api/multithreaded/stop_hook/Makefile
 create mode 100644 lldb/test/API/api/multithreaded/stop_hook/TestMultithreadedStopHook.py
 rename lldb/test/API/api/multithreaded/{ => stop_hook}/some_cmd.py (100%)
 rename lldb/test/API/api/multithreaded/{ => stop_hook}/test_stop-hook.cpp (100%)

diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 2e1dab2e6717be..da87c28a6751e2 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1857,6 +1857,28 @@ def buildProgram(self, sources, exe_name):
         d = {"CXX_SOURCES": sources, "EXE": exe_name}
         self.build(dictionary=d)
 
+    def buildAndRunDriver(self, driver_sources, inferior_sources):
+        """Build a driver program that links with LLDB and an inferior program,
+        then run the driver with the path to the inferior as its argument.
+        """
+        # The driver links against the host liblldb, so the compiler's target
+        # triple must match liblldb's. Driver tests don't run remotely, so the
+        # OS is the same and only the architecture needs to be checked.
+        if self.getLldbArchitecture() != self.getArchitecture():
+            self.skipTest(
+                "This test is only run if the target arch is the same as the lldb binary arch"
+            )
+
+        self.buildProgram(inferior_sources, "inferior")
+        self.buildDriver(driver_sources, "driver")
+
+        env = dict(os.environ)
+        env["LLDB_TEST_SOURCE_DIR"] = self.getSourceDir()
+        check_call(
+            [self.getBuildArtifact("driver"), self.getBuildArtifact("inferior")],
+            env=env,
+        )
+
     def findBuiltClang(self):
         """Tries to find and use Clang from the build directory as the compiler (instead of the system compiler)."""
         paths_to_try = [
diff --git a/lldb/test/API/api/multithreaded/Makefile b/lldb/test/API/api/multithreaded/Makefile
deleted file mode 100644
index de4ec12b13cbce..00000000000000
--- a/lldb/test/API/api/multithreaded/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-ENABLE_THREADS := YES
-CXX_SOURCES := main.cpp
-
-include Makefile.rules
diff --git a/lldb/test/API/api/multithreaded/TestMultithreaded.py b/lldb/test/API/api/multithreaded/TestMultithreaded.py
deleted file mode 100644
index 8275626fba20e1..00000000000000
--- a/lldb/test/API/api/multithreaded/TestMultithreaded.py
+++ /dev/null
@@ -1,124 +0,0 @@
-"""Test the lldb public C++ api breakpoint callbacks."""
-
-import os
-import subprocess
-
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-
- at requireThreadSupport
- at skipIfNoSBHeaders
-class SBBreakpointCallbackCase(TestBase):
-    SHARED_BUILD_TESTCASE = False
-    NO_DEBUG_INFO_TESTCASE = True
-
-    def setUp(self):
-        TestBase.setUp(self)
-
-    @skipIfWindows  # https://github.com/llvm/llvm-project/issues/225860
-    @skipIfRemote
-    @skipIfHostIncompatibleWithTarget
-    # Occasional SIGABRT, see https://github.com/llvm/llvm-project/issues/225860.
-    @skipIf(oslist=["linux"], archs=["aarch64"])
-    def test_python_stop_hook(self):
-        """Test that you can run a python command in a stop-hook when stdin is File based."""
-        self.build_and_test("driver.cpp test_stop-hook.cpp", "test_python_stop_hook")
-
-    @skipIfRemote
-    @skipIfHostIncompatibleWithTarget
-    def test_breakpoint_callback(self):
-        """Test the that SBBreakpoint callback is invoked when a breakpoint is hit."""
-        self.build_and_test(
-            "driver.cpp test_breakpoint_callback.cpp", "test_breakpoint_callback"
-        )
-
-    @skipIfRemote
-    @skipIfWindows  # https://github.com/llvm/llvm-project/issues/224303
-    @skipIfHostIncompatibleWithTarget
-    def test_breakpoint_location_callback(self):
-        """Test the that SBBreakpointLocation callback is invoked when a breakpoint is hit."""
-        self.build_and_test(
-            "driver.cpp test_breakpoint_location_callback.cpp",
-            "test_breakpoint_location_callback",
-        )
-
-    @skipIfRemote
-    @expectedFlakeyFreeBSD
-    @skipIfHostIncompatibleWithTarget
-    def test_sb_api_listener_event_description(self):
-        """Test the description of an SBListener breakpoint event is valid."""
-        self.build_and_test(
-            "driver.cpp listener_test.cpp test_listener_event_description.cpp",
-            "test_listener_event_description",
-        )
-
-    @skipIfRemote
-    @expectedFlakeyFreeBSD
-    @skipIfHostIncompatibleWithTarget
-    def test_sb_api_listener_event_process_state(self):
-        """Test that a registered SBListener receives events when a process
-        changes state.
-        """
-        self.build_and_test(
-            "driver.cpp listener_test.cpp test_listener_event_process_state.cpp",
-            "test_listener_event_process_state",
-        )
-
-    @skipIfRemote
-    @expectedFlakeyFreeBSD
-    @skipIfWindows  # https://github.com/llvm/llvm-project/issues/231113
-    @skipIf(oslist=["linux"])  # flakey
-    @skipIfHostIncompatibleWithTarget
-    def test_sb_api_listener_resume(self):
-        """Test that a process can be resumed from a non-main thread."""
-        self.build_and_test(
-            "driver.cpp listener_test.cpp test_listener_resume.cpp",
-            "test_listener_resume",
-        )
-
-    @skipIfRemote
-    @skipIfHostIncompatibleWithTarget
-    def test_concurrent_unwind(self):
-        """Test that you can run a python command in a stop-hook when stdin is File based."""
-        self.build_and_test(
-            "driver.cpp test_concurrent_unwind.cpp",
-            "test_concurrent_unwind",
-            inferior_source="deep_stack.cpp",
-        )
-
-    def build_and_test(self, sources, test_name, inferior_source="inferior.cpp"):
-        """Build LLDB test from sources, and run expecting 0 exit code"""
-
-        # These tests link against host lldb API.
-        # Compiler's target triple must match liblldb triple
-        # because remote is disabled, we can assume that the os is the same
-        # still need to check architecture
-        if self.getLldbArchitecture() != self.getArchitecture():
-            self.skipTest(
-                "This test is only run if the target arch is the same as the lldb binary arch"
-            )
-
-        self.inferior = "inferior_program"
-        self.buildProgram(inferior_source, self.inferior)
-        self.addTearDownHook(lambda: os.remove(self.getBuildArtifact(self.inferior)))
-
-        self.buildDriver(sources, test_name)
-        self.addTearDownHook(lambda: os.remove(self.getBuildArtifact(test_name)))
-
-        test_exe = self.getBuildArtifact(test_name)
-        exe = [test_exe, self.getBuildArtifact(self.inferior)]
-
-        # Tests locate their support files (e.g. test_stop-hook.cpp's
-        # some_cmd.py) via the LLDB_TEST_SOURCE_DIR environment variable.
-        env = dict(os.environ)
-        env["LLDB_TEST_SOURCE_DIR"] = self.getSourceDir()
-
-        # check_call will raise a CalledProcessError if the executable doesn't
-        # return exit code 0 to indicate success.  We can let this exception go
-        # - the test harness will recognize it as a test failure.
-        subprocess.check_call(exe, env=env)
-
-    def build_program(self, sources, program):
-        return self.buildDriver(sources, program)
diff --git a/lldb/test/API/api/multithreaded/breakpoint_callback/Makefile b/lldb/test/API/api/multithreaded/breakpoint_callback/Makefile
new file mode 100644
index 00000000000000..beaa00d907bf59
--- /dev/null
+++ b/lldb/test/API/api/multithreaded/breakpoint_callback/Makefile
@@ -0,0 +1,8 @@
+ENABLE_THREADS := YES
+CXX_SOURCES := main.cpp
+
+# Sources shared between the multithreaded tests live in the parent directory.
+override VPATH += $(SRCDIR)/..
+override CFLAGS_EXTRAS += -I$(SRCDIR)/..
+
+include Makefile.rules
diff --git a/lldb/test/API/api/multithreaded/breakpoint_callback/TestMultithreadedBreakpointCallback.py b/lldb/test/API/api/multithreaded/breakpoint_callback/TestMultithreadedBreakpointCallback.py
new file mode 100644
index 00000000000000..37976e58c20ab7
--- /dev/null
+++ b/lldb/test/API/api/multithreaded/breakpoint_callback/TestMultithreadedBreakpointCallback.py
@@ -0,0 +1,18 @@
+"""Test that the SBBreakpoint callback is invoked when a breakpoint is hit."""
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+
+ at requireThreadSupport
+ at skipIfNoSBHeaders
+ at skipIfRemote
+ at skipIfHostIncompatibleWithTarget
+class MultithreadedBreakpointCallbackTestCase(TestBase):
+    SHARED_BUILD_TESTCASE = False
+    NO_DEBUG_INFO_TESTCASE = True
+
+    def test(self):
+        self.buildAndRunDriver(
+            "driver.cpp test_breakpoint_callback.cpp", "inferior.cpp"
+        )
diff --git a/lldb/test/API/api/multithreaded/test_breakpoint_callback.cpp b/lldb/test/API/api/multithreaded/breakpoint_callback/test_breakpoint_callback.cpp
similarity index 100%
rename from lldb/test/API/api/multithreaded/test_breakpoint_callback.cpp
rename to lldb/test/API/api/multithreaded/breakpoint_callback/test_breakpoint_callback.cpp
diff --git a/lldb/test/API/api/multithreaded/breakpoint_location_callback/Makefile b/lldb/test/API/api/multithreaded/breakpoint_location_callback/Makefile
new file mode 100644
index 00000000000000..beaa00d907bf59
--- /dev/null
+++ b/lldb/test/API/api/multithreaded/breakpoint_location_callback/Makefile
@@ -0,0 +1,8 @@
+ENABLE_THREADS := YES
+CXX_SOURCES := main.cpp
+
+# Sources shared between the multithreaded tests live in the parent directory.
+override VPATH += $(SRCDIR)/..
+override CFLAGS_EXTRAS += -I$(SRCDIR)/..
+
+include Makefile.rules
diff --git a/lldb/test/API/api/multithreaded/breakpoint_location_callback/TestMultithreadedBreakpointLocationCallback.py b/lldb/test/API/api/multithreaded/breakpoint_location_callback/TestMultithreadedBreakpointLocationCallback.py
new file mode 100644
index 00000000000000..8adb240b3ea510
--- /dev/null
+++ b/lldb/test/API/api/multithreaded/breakpoint_location_callback/TestMultithreadedBreakpointLocationCallback.py
@@ -0,0 +1,19 @@
+"""Test that the SBBreakpointLocation callback is invoked when a breakpoint is hit."""
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+
+ at requireThreadSupport
+ at skipIfNoSBHeaders
+ at skipIfRemote
+ at skipIfHostIncompatibleWithTarget
+class MultithreadedBreakpointLocationCallbackTestCase(TestBase):
+    SHARED_BUILD_TESTCASE = False
+    NO_DEBUG_INFO_TESTCASE = True
+
+    @skipIfWindows  # https://github.com/llvm/llvm-project/issues/224303
+    def test(self):
+        self.buildAndRunDriver(
+            "driver.cpp test_breakpoint_location_callback.cpp", "inferior.cpp"
+        )
diff --git a/lldb/test/API/api/multithreaded/test_breakpoint_location_callback.cpp b/lldb/test/API/api/multithreaded/breakpoint_location_callback/test_breakpoint_location_callback.cpp
similarity index 100%
rename from lldb/test/API/api/multithreaded/test_breakpoint_location_callback.cpp
rename to lldb/test/API/api/multithreaded/breakpoint_location_callback/test_breakpoint_location_callback.cpp
diff --git a/lldb/test/API/api/multithreaded/concurrent_unwind/Makefile b/lldb/test/API/api/multithreaded/concurrent_unwind/Makefile
new file mode 100644
index 00000000000000..beaa00d907bf59
--- /dev/null
+++ b/lldb/test/API/api/multithreaded/concurrent_unwind/Makefile
@@ -0,0 +1,8 @@
+ENABLE_THREADS := YES
+CXX_SOURCES := main.cpp
+
+# Sources shared between the multithreaded tests live in the parent directory.
+override VPATH += $(SRCDIR)/..
+override CFLAGS_EXTRAS += -I$(SRCDIR)/..
+
+include Makefile.rules
diff --git a/lldb/test/API/api/multithreaded/concurrent_unwind/TestMultithreadedConcurrentUnwind.py b/lldb/test/API/api/multithreaded/concurrent_unwind/TestMultithreadedConcurrentUnwind.py
new file mode 100644
index 00000000000000..9d8023a777238b
--- /dev/null
+++ b/lldb/test/API/api/multithreaded/concurrent_unwind/TestMultithreadedConcurrentUnwind.py
@@ -0,0 +1,18 @@
+"""Test that multiple threads can unwind the same thread concurrently without deadlocking."""
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+
+ at requireThreadSupport
+ at skipIfNoSBHeaders
+ at skipIfRemote
+ at skipIfHostIncompatibleWithTarget
+class MultithreadedConcurrentUnwindTestCase(TestBase):
+    SHARED_BUILD_TESTCASE = False
+    NO_DEBUG_INFO_TESTCASE = True
+
+    def test(self):
+        self.buildAndRunDriver(
+            "driver.cpp test_concurrent_unwind.cpp", "deep_stack.cpp"
+        )
diff --git a/lldb/test/API/api/multithreaded/deep_stack.cpp b/lldb/test/API/api/multithreaded/concurrent_unwind/deep_stack.cpp
similarity index 100%
rename from lldb/test/API/api/multithreaded/deep_stack.cpp
rename to lldb/test/API/api/multithreaded/concurrent_unwind/deep_stack.cpp
diff --git a/lldb/test/API/api/multithreaded/test_concurrent_unwind.cpp b/lldb/test/API/api/multithreaded/concurrent_unwind/test_concurrent_unwind.cpp
similarity index 100%
rename from lldb/test/API/api/multithreaded/test_concurrent_unwind.cpp
rename to lldb/test/API/api/multithreaded/concurrent_unwind/test_concurrent_unwind.cpp
diff --git a/lldb/test/API/api/multithreaded/listener_event_description/Makefile b/lldb/test/API/api/multithreaded/listener_event_description/Makefile
new file mode 100644
index 00000000000000..beaa00d907bf59
--- /dev/null
+++ b/lldb/test/API/api/multithreaded/listener_event_description/Makefile
@@ -0,0 +1,8 @@
+ENABLE_THREADS := YES
+CXX_SOURCES := main.cpp
+
+# Sources shared between the multithreaded tests live in the parent directory.
+override VPATH += $(SRCDIR)/..
+override CFLAGS_EXTRAS += -I$(SRCDIR)/..
+
+include Makefile.rules
diff --git a/lldb/test/API/api/multithreaded/listener_event_description/TestMultithreadedListenerEventDescription.py b/lldb/test/API/api/multithreaded/listener_event_description/TestMultithreadedListenerEventDescription.py
new file mode 100644
index 00000000000000..90e4118e20a51f
--- /dev/null
+++ b/lldb/test/API/api/multithreaded/listener_event_description/TestMultithreadedListenerEventDescription.py
@@ -0,0 +1,20 @@
+"""Test that the description of an SBListener breakpoint event is valid."""
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+
+ at requireThreadSupport
+ at skipIfNoSBHeaders
+ at skipIfRemote
+ at skipIfHostIncompatibleWithTarget
+class MultithreadedListenerEventDescriptionTestCase(TestBase):
+    SHARED_BUILD_TESTCASE = False
+    NO_DEBUG_INFO_TESTCASE = True
+
+    @expectedFlakeyFreeBSD
+    def test(self):
+        self.buildAndRunDriver(
+            "driver.cpp listener_test.cpp test_listener_event_description.cpp",
+            "inferior.cpp",
+        )
diff --git a/lldb/test/API/api/multithreaded/test_listener_event_description.cpp b/lldb/test/API/api/multithreaded/listener_event_description/test_listener_event_description.cpp
similarity index 100%
rename from lldb/test/API/api/multithreaded/test_listener_event_description.cpp
rename to lldb/test/API/api/multithreaded/listener_event_description/test_listener_event_description.cpp
diff --git a/lldb/test/API/api/multithreaded/listener_event_process_state/Makefile b/lldb/test/API/api/multithreaded/listener_event_process_state/Makefile
new file mode 100644
index 00000000000000..beaa00d907bf59
--- /dev/null
+++ b/lldb/test/API/api/multithreaded/listener_event_process_state/Makefile
@@ -0,0 +1,8 @@
+ENABLE_THREADS := YES
+CXX_SOURCES := main.cpp
+
+# Sources shared between the multithreaded tests live in the parent directory.
+override VPATH += $(SRCDIR)/..
+override CFLAGS_EXTRAS += -I$(SRCDIR)/..
+
+include Makefile.rules
diff --git a/lldb/test/API/api/multithreaded/listener_event_process_state/TestMultithreadedListenerEventProcessState.py b/lldb/test/API/api/multithreaded/listener_event_process_state/TestMultithreadedListenerEventProcessState.py
new file mode 100644
index 00000000000000..7869fad062778c
--- /dev/null
+++ b/lldb/test/API/api/multithreaded/listener_event_process_state/TestMultithreadedListenerEventProcessState.py
@@ -0,0 +1,20 @@
+"""Test that a registered SBListener receives events when a process changes state."""
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+
+ at requireThreadSupport
+ at skipIfNoSBHeaders
+ at skipIfRemote
+ at skipIfHostIncompatibleWithTarget
+class MultithreadedListenerEventProcessStateTestCase(TestBase):
+    SHARED_BUILD_TESTCASE = False
+    NO_DEBUG_INFO_TESTCASE = True
+
+    @expectedFlakeyFreeBSD
+    def test(self):
+        self.buildAndRunDriver(
+            "driver.cpp listener_test.cpp test_listener_event_process_state.cpp",
+            "inferior.cpp",
+        )
diff --git a/lldb/test/API/api/multithreaded/test_listener_event_process_state.cpp b/lldb/test/API/api/multithreaded/listener_event_process_state/test_listener_event_process_state.cpp
similarity index 100%
rename from lldb/test/API/api/multithreaded/test_listener_event_process_state.cpp
rename to lldb/test/API/api/multithreaded/listener_event_process_state/test_listener_event_process_state.cpp
diff --git a/lldb/test/API/api/multithreaded/listener_resume/Makefile b/lldb/test/API/api/multithreaded/listener_resume/Makefile
new file mode 100644
index 00000000000000..beaa00d907bf59
--- /dev/null
+++ b/lldb/test/API/api/multithreaded/listener_resume/Makefile
@@ -0,0 +1,8 @@
+ENABLE_THREADS := YES
+CXX_SOURCES := main.cpp
+
+# Sources shared between the multithreaded tests live in the parent directory.
+override VPATH += $(SRCDIR)/..
+override CFLAGS_EXTRAS += -I$(SRCDIR)/..
+
+include Makefile.rules
diff --git a/lldb/test/API/api/multithreaded/listener_resume/TestMultithreadedListenerResume.py b/lldb/test/API/api/multithreaded/listener_resume/TestMultithreadedListenerResume.py
new file mode 100644
index 00000000000000..9f9da27bd914a8
--- /dev/null
+++ b/lldb/test/API/api/multithreaded/listener_resume/TestMultithreadedListenerResume.py
@@ -0,0 +1,21 @@
+"""Test that a process can be resumed from a non-main thread."""
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+
+ at requireThreadSupport
+ at skipIfNoSBHeaders
+ at skipIfRemote
+ at skipIfHostIncompatibleWithTarget
+class MultithreadedListenerResumeTestCase(TestBase):
+    SHARED_BUILD_TESTCASE = False
+    NO_DEBUG_INFO_TESTCASE = True
+
+    @expectedFlakeyFreeBSD
+    @skipIfWindows  # https://github.com/llvm/llvm-project/issues/231113
+    @skipIf(oslist=["linux"])  # flakey
+    def test(self):
+        self.buildAndRunDriver(
+            "driver.cpp listener_test.cpp test_listener_resume.cpp", "inferior.cpp"
+        )
diff --git a/lldb/test/API/api/multithreaded/test_listener_resume.cpp b/lldb/test/API/api/multithreaded/listener_resume/test_listener_resume.cpp
similarity index 100%
rename from lldb/test/API/api/multithreaded/test_listener_resume.cpp
rename to lldb/test/API/api/multithreaded/listener_resume/test_listener_resume.cpp
diff --git a/lldb/test/API/api/multithreaded/stop_hook/Makefile b/lldb/test/API/api/multithreaded/stop_hook/Makefile
new file mode 100644
index 00000000000000..beaa00d907bf59
--- /dev/null
+++ b/lldb/test/API/api/multithreaded/stop_hook/Makefile
@@ -0,0 +1,8 @@
+ENABLE_THREADS := YES
+CXX_SOURCES := main.cpp
+
+# Sources shared between the multithreaded tests live in the parent directory.
+override VPATH += $(SRCDIR)/..
+override CFLAGS_EXTRAS += -I$(SRCDIR)/..
+
+include Makefile.rules
diff --git a/lldb/test/API/api/multithreaded/stop_hook/TestMultithreadedStopHook.py b/lldb/test/API/api/multithreaded/stop_hook/TestMultithreadedStopHook.py
new file mode 100644
index 00000000000000..3559ae83e7892d
--- /dev/null
+++ b/lldb/test/API/api/multithreaded/stop_hook/TestMultithreadedStopHook.py
@@ -0,0 +1,19 @@
+"""Test that you can run a python command in a stop-hook when stdin is File based."""
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+
+ at requireThreadSupport
+ at skipIfNoSBHeaders
+ at skipIfRemote
+ at skipIfHostIncompatibleWithTarget
+class MultithreadedStopHookTestCase(TestBase):
+    SHARED_BUILD_TESTCASE = False
+    NO_DEBUG_INFO_TESTCASE = True
+
+    @skipIfWindows  # https://github.com/llvm/llvm-project/issues/225860
+    # Occasional SIGABRT, see https://github.com/llvm/llvm-project/issues/225860.
+    @skipIf(oslist=["linux"], archs=["aarch64"])
+    def test(self):
+        self.buildAndRunDriver("driver.cpp test_stop-hook.cpp", "inferior.cpp")
diff --git a/lldb/test/API/api/multithreaded/some_cmd.py b/lldb/test/API/api/multithreaded/stop_hook/some_cmd.py
similarity index 100%
rename from lldb/test/API/api/multithreaded/some_cmd.py
rename to lldb/test/API/api/multithreaded/stop_hook/some_cmd.py
diff --git a/lldb/test/API/api/multithreaded/test_stop-hook.cpp b/lldb/test/API/api/multithreaded/stop_hook/test_stop-hook.cpp
similarity index 100%
rename from lldb/test/API/api/multithreaded/test_stop-hook.cpp
rename to lldb/test/API/api/multithreaded/stop_hook/test_stop-hook.cpp



More information about the lldb-commits mailing list