[Lldb-commits] [lldb] cd18e2e - [lldb/test] Fix flakyness in TestNonStop.test_stdio
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Thu Jul 21 07:53:32 PDT 2022
Author: Pavel Labath
Date: 2022-07-21T16:53:13+02:00
New Revision: cd18e2ea3f4e87f8804a7d6661d5596ef1f07b81
URL: https://github.com/llvm/llvm-project/commit/cd18e2ea3f4e87f8804a7d6661d5596ef1f07b81
DIFF: https://github.com/llvm/llvm-project/commit/cd18e2ea3f4e87f8804a7d6661d5596ef1f07b81.diff
LOG: [lldb/test] Fix flakyness in TestNonStop.test_stdio
The test was assuming that the output will come in two messages. The
truth is that it will come in **at least** two messages.
Added:
Modified:
lldb/test/API/tools/lldb-server/TestNonStop.py
Removed:
################################################################################
diff --git a/lldb/test/API/tools/lldb-server/TestNonStop.py b/lldb/test/API/tools/lldb-server/TestNonStop.py
index 0031f1885e88c..ff3407dcfa8a8 100644
--- a/lldb/test/API/tools/lldb-server/TestNonStop.py
+++ b/lldb/test/API/tools/lldb-server/TestNonStop.py
@@ -320,24 +320,23 @@ def test_stdio(self):
"send packet: %Stop:W00#00",
], True)
ret = self.expect_gdbremote_sequence()
- self.assertIn(ret["O_content"], b"message 1\r\n")
- # Now, this is somewhat messy. expect_gdbremote_sequence() will
- # automatically consume output packets, so we just send vStdio,
- # assume the first reply was consumed, send another one and expect
- # a non-consumable "OK" reply.
+ # We know there will be at least two messages, but there may be more.
+ # Loop until we have everything. The first message waiting for us in the
+ # packet queue.
+ count = 1
+ output = self._server.get_raw_output_packet()
+ while not (b"message 2\r\n" in output):
+ self._server.send_packet(b"vStdio")
+ output += self._server.get_raw_output_packet()
+ count += 1
+ self.assertGreaterEqual(count, 2)
+
self.reset_test_sequence()
self.test_sequence.add_log_lines(
["read packet: $vStdio#00",
- "read packet: $vStdio#00",
"send packet: $OK#00",
- ], True)
- ret = self.expect_gdbremote_sequence()
- self.assertIn(ret["O_content"], b"message 2\r\n")
-
- self.reset_test_sequence()
- self.test_sequence.add_log_lines(
- ["read packet: $vStopped#00",
+ "read packet: $vStopped#00",
"send packet: $OK#00",
], True)
self.expect_gdbremote_sequence()
More information about the lldb-commits
mailing list