[Lldb-commits] [lldb] dd4703e - [lldb][test] Always kill test processes (#207181)
via lldb-commits
lldb-commits at lists.llvm.org
Thu Jul 2 09:24:15 PDT 2026
Author: Raphael Isemann
Date: 2026-07-02T17:24:09+01:00
New Revision: dd4703ea0d262f1942879f0ecae669e52a95a270
URL: https://github.com/llvm/llvm-project/commit/dd4703ea0d262f1942879f0ecae669e52a95a270
DIFF: https://github.com/llvm/llvm-project/commit/dd4703ea0d262f1942879f0ecae669e52a95a270.diff
LOG: [lldb][test] Always kill test processes (#207181)
Added:
Modified:
lldb/packages/Python/lldbsuite/test/lldbtest.py
lldb/test/API/commands/process/attach/TestProcessAttach.py
Removed:
################################################################################
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 416b357754015..7adec7d677b3f 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1203,6 +1203,18 @@ def tearDown(self):
for dict in reversed(self.dicts):
self.cleanup(dictionary=dict)
+ # Kill any process a target is still holding on to.
+ for i in range(self.dbg.GetNumTargets()):
+ process = self.dbg.GetTargetAtIndex(i).GetProcess()
+ # Only kill processes that are still alive.
+ if process.IsValid() and process.is_alive:
+ process.Kill()
+ self.assertEqual(
+ process.GetState(),
+ lldb.eStateExited,
+ "Failed to kill process during teardown",
+ )
+
# Remove subprocesses created by the test.
self.cleanupSubprocesses()
diff --git a/lldb/test/API/commands/process/attach/TestProcessAttach.py b/lldb/test/API/commands/process/attach/TestProcessAttach.py
index 5abcf69d0acba..f0fa9af4e4d0d 100644
--- a/lldb/test/API/commands/process/attach/TestProcessAttach.py
+++ b/lldb/test/API/commands/process/attach/TestProcessAttach.py
@@ -142,10 +142,3 @@ def test_attach_to_process_by_id_correct_executable_offset(self):
)
self.runCmd("process continue")
self.expect("v g_val", substrs=["12345"])
-
- def tearDown(self):
- # Destroy process before TestBase.tearDown()
- self.dbg.GetSelectedTarget().GetProcess().Destroy()
-
- # Call super's tearDown().
- TestBase.tearDown(self)
More information about the lldb-commits
mailing list