[Lldb-commits] [lldb] 8b85f68 - [lldb/Test] Remove custom tearDownHooks from GDB Remote tests
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Wed Jul 15 13:18:13 PDT 2020
Author: Jonas Devlieghere
Date: 2020-07-15T13:18:06-07:00
New Revision: 8b85f68ee2ddd983c027adbda9567f06d25b3c51
URL: https://github.com/llvm/llvm-project/commit/8b85f68ee2ddd983c027adbda9567f06d25b3c51
DIFF: https://github.com/llvm/llvm-project/commit/8b85f68ee2ddd983c027adbda9567f06d25b3c51.diff
LOG: [lldb/Test] Remove custom tearDownHooks from GDB Remote tests
Remove custom tearDownHooks from GDB Remote tests as we now cleanup
subprocesses unconditionally. This also changes the termination order to
be the reverse of the creation order. I don't think anything is relying
on that right now, but it better fits the setup/teardown paradigm.
Added:
Modified:
lldb/packages/Python/lldbsuite/test/lldbtest.py
lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
Removed:
################################################################################
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index b1add79e488d..25805726f9b3 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -884,8 +884,8 @@ def setAsync(self, value):
self.addTearDownHook(lambda: self.dbg.SetAsync(old_async))
def cleanupSubprocesses(self):
- # Ensure any subprocesses are cleaned up
- for p in self.subprocesses:
+ # Terminate subprocesses in reverse order from how they were created.
+ for p in reversed(self.subprocesses):
p.terminate()
del p
del self.subprocesses[:]
diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
index ac611bcca169..0b81912e3d3f 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
@@ -402,7 +402,6 @@ def launch_debug_monitor(self, attach_pid=None, logfile=None):
self.debug_monitor_exe,
commandline_args,
install_remote=False)
- self.addTearDownHook(self.cleanupSubprocesses)
self.assertIsNotNone(server)
# If we're receiving the stub's listening port from the named pipe, do
@@ -418,15 +417,6 @@ def connect_to_debug_monitor(self, attach_pid=None):
server = self.launch_debug_monitor(attach_pid=attach_pid)
self.assertIsNotNone(server)
- def shutdown_debug_monitor():
- try:
- server.terminate()
- except:
- logger.warning(
- "failed to terminate server for debug monitor: {}; ignoring".format(
- sys.exc_info()[0]))
- self.addTearDownHook(shutdown_debug_monitor)
-
# Schedule debug monitor to be shut down during teardown.
logger = self.logger
@@ -445,15 +435,6 @@ def shutdown_debug_monitor():
# Schedule debug monitor to be shut down during teardown.
logger = self.logger
- def shutdown_debug_monitor():
- try:
- server.terminate()
- except:
- logger.warning(
- "failed to terminate server for debug monitor: {}; ignoring".format(
- sys.exc_info()[0]))
- self.addTearDownHook(shutdown_debug_monitor)
-
connect_attemps = 0
MAX_CONNECT_ATTEMPTS = 10
@@ -506,17 +487,7 @@ def launch_process_for_attach(
if sleep_seconds:
args.append("sleep:%d" % sleep_seconds)
- inferior = self.spawnSubprocess(exe_path, args)
-
- def shutdown_process_for_attach():
- try:
- inferior.terminate()
- except:
- logger.warning(
- "failed to terminate inferior process for attach: {}; ignoring".format(
- sys.exc_info()[0]))
- self.addTearDownHook(shutdown_process_for_attach)
- return inferior
+ return self.spawnSubprocess(exe_path, args)
def prep_debug_monitor_and_inferior(
self,
More information about the lldb-commits
mailing list