labath created this revision. labath added a reviewer: mgorny. labath requested review of this revision. Herald added a project: LLDB.
This is a preparatory commit to enable mocking of qemu startup. That will involve running the mock server in a separate process, so there's no need for multithreading. Initialization is moved from the start function into the constructor (which can then take an actual socket instead of a class), and the run method is made public. Depends on D114156 <https://reviews.llvm.org/D114156>. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D114157 Files: lldb/packages/Python/lldbsuite/test/gdbclientutils.py lldb/packages/Python/lldbsuite/test/lldbgdbclient.py Index: lldb/packages/Python/lldbsuite/test/lldbgdbclient.py =================================================================== --- lldb/packages/Python/lldbsuite/test/lldbgdbclient.py +++ lldb/packages/Python/lldbsuite/test/lldbgdbclient.py @@ -19,7 +19,7 @@ def setUp(self): TestBase.setUp(self) - self.server = MockGDBServer(socket_class=self.server_socket_class) + self.server = MockGDBServer(self.server_socket_class()) self.server.start() def tearDown(self): Index: lldb/packages/Python/lldbsuite/test/gdbclientutils.py =================================================================== --- lldb/packages/Python/lldbsuite/test/gdbclientutils.py +++ lldb/packages/Python/lldbsuite/test/gdbclientutils.py @@ -461,18 +461,16 @@ _receivedDataOffset = None _shouldSendAck = True - def __init__(self, socket_class): - self._socket_class = socket_class + def __init__(self, socket): + self._socket = socket self.responder = MockGDBServerResponder() def start(self): - self._socket = self._socket_class() # Start a thread that waits for a client connection. - self._thread = threading.Thread(target=self._run) + self._thread = threading.Thread(target=self.run) self._thread.start() def stop(self): - self._socket.close_server() self._thread.join() self._thread = None @@ -482,7 +480,7 @@ def get_connect_url(self): return self._socket.get_connect_url() - def _run(self): + def run(self): # For testing purposes, we only need to worry about one client # connecting just one time. try:
Index: lldb/packages/Python/lldbsuite/test/lldbgdbclient.py =================================================================== --- lldb/packages/Python/lldbsuite/test/lldbgdbclient.py +++ lldb/packages/Python/lldbsuite/test/lldbgdbclient.py @@ -19,7 +19,7 @@ def setUp(self): TestBase.setUp(self) - self.server = MockGDBServer(socket_class=self.server_socket_class) + self.server = MockGDBServer(self.server_socket_class()) self.server.start() def tearDown(self): Index: lldb/packages/Python/lldbsuite/test/gdbclientutils.py =================================================================== --- lldb/packages/Python/lldbsuite/test/gdbclientutils.py +++ lldb/packages/Python/lldbsuite/test/gdbclientutils.py @@ -461,18 +461,16 @@ _receivedDataOffset = None _shouldSendAck = True - def __init__(self, socket_class): - self._socket_class = socket_class + def __init__(self, socket): + self._socket = socket self.responder = MockGDBServerResponder() def start(self): - self._socket = self._socket_class() # Start a thread that waits for a client connection. - self._thread = threading.Thread(target=self._run) + self._thread = threading.Thread(target=self.run) self._thread.start() def stop(self): - self._socket.close_server() self._thread.join() self._thread = None @@ -482,7 +480,7 @@ def get_connect_url(self): return self._socket.get_connect_url() - def _run(self): + def run(self): # For testing purposes, we only need to worry about one client # connecting just one time. try:
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits