diff options
| author | Daniel Sanders <daniel_l_sanders@apple.com> | 2025-10-21 01:38:24 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-21 09:38:24 +0100 |
| commit | f188c97cc193773071b0b61ebf214705fb84189e (patch) | |
| tree | 8d3c609a03c13e281933368b82f5a6ac8a30ad31 /lldb/packages/Python/lldbsuite/test/lldbgdbclient.py | |
| parent | 8da0df49568206544f64eea890e51354d04187cd (diff) | |
| download | llvm-f188c97cc193773071b0b61ebf214705fb84189e.zip llvm-f188c97cc193773071b0b61ebf214705fb84189e.tar.gz llvm-f188c97cc193773071b0b61ebf214705fb84189e.tar.bz2 | |
[lldb] Add bidirectional packetLog to gdbclientutils.py (#162176)
While debugging the tests for #155000 I found it helpful to have both
sides
of the simulated gdb-rsp traffic rather than just the responses so I've
extended
the packetLog in MockGDBServerResponder to record traffic in both
directions.
Tests have been updated accordingly
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/lldbgdbclient.py')
| -rw-r--r-- | lldb/packages/Python/lldbsuite/test/lldbgdbclient.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lldbgdbclient.py b/lldb/packages/Python/lldbsuite/test/lldbgdbclient.py index 599f787..9b2a89e 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbgdbclient.py +++ b/lldb/packages/Python/lldbsuite/test/lldbgdbclient.py @@ -10,7 +10,7 @@ class GDBRemoteTestBase(TestBase): Base class for GDB client tests. This class will setup and start a mock GDB server for the test to use. - It also provides assertPacketLogContains, which simplifies the checking + It also provides assertPacketLogReceived, which simplifies the checking of packets sent by the client. """ @@ -60,30 +60,32 @@ class GDBRemoteTestBase(TestBase): self.assertTrue(process, PROCESS_IS_VALID) return process - def assertPacketLogContains(self, packets, log=None): + def assertPacketLogReceived(self, packets, log: PacketLog = None): """ - Assert that the mock server's packet log contains the given packets. + Assert that the mock server's packet log received the given packets. The packet log includes all packets sent by the client and received - by the server. This fuction makes it easy to verify that the client + by the server. This function makes it easy to verify that the client sent the expected packets to the server. The check does not require that the packets be consecutive, but does require that they are ordered in the log as they ordered in the arg. """ if log is None: - log = self.server.responder.packetLog + received = self.server.responder.packetLog.get_received() + else: + received = log.get_received() i = 0 j = 0 - while i < len(packets) and j < len(log): - if log[j] == packets[i]: + while i < len(packets) and j < len(received): + if received[j] == packets[i]: i += 1 j += 1 if i < len(packets): self.fail( "Did not receive: %s\nLast 10 packets:\n\t%s" - % (packets[i], "\n\t".join(log)) + % (packets[i], "\n\t".join(received)) ) |
