[Lldb-commits] [lldb] 0806927 - [lldb] [test] Fix test_c_both_nonstop flakiness
Michał Górny via lldb-commits
lldb-commits at lists.llvm.org
Mon Aug 1 09:52:53 PDT 2022
Author: Michał Górny
Date: 2022-08-01T18:52:47+02:00
New Revision: 080692797724eefd15de00500d8d802e98230622
URL: https://github.com/llvm/llvm-project/commit/080692797724eefd15de00500d8d802e98230622
DIFF: https://github.com/llvm/llvm-project/commit/080692797724eefd15de00500d8d802e98230622.diff
LOG: [lldb] [test] Fix test_c_both_nonstop flakiness
Thanks to Pavel Labath for reporting this and suggesting a fix.
Sponsored by: The FreeBSD Foundation
Added:
Modified:
lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py
Removed:
################################################################################
diff --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py b/lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py
index 0868c32bdd322..daaa15e86ab4a 100644
--- a/lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py
+++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py
@@ -113,6 +113,16 @@ def test_vCont_interspersed_nonstop(self):
self.resume_one_test(run_order=["parent", "child", "parent", "child"],
use_vCont=True, nonstop=True)
+ def get_all_output_via_vStdio(self, output_test):
+ # The output may be split into an arbitrary number of messages.
+ # Loop until we have everything. The first message is waiting for us
+ # in the packet queue.
+ output = self._server.get_raw_output_packet()
+ while not output_test(output):
+ self._server.send_packet(b"vStdio")
+ output += self._server.get_raw_output_packet()
+ return output
+
@add_test_categories(["fork"])
def test_c_both_nonstop(self):
lock1 = self.getBuildArtifact("lock1")
@@ -132,13 +142,11 @@ def test_c_both_nonstop(self):
"read packet: $c#00",
"send packet: $OK#00",
{"direction": "send", "regex": "%Stop:T.*"},
- # see the comment in TestNonStop.py, test_stdio
- "read packet: $vStdio#00",
- "read packet: $vStdio#00",
- "send packet: $OK#00",
], True)
- ret = self.expect_gdbremote_sequence()
- self.assertIn("PID: {}".format(int(parent_pid, 16)).encode(),
- ret["O_content"])
- self.assertIn("PID: {}".format(int(child_pid, 16)).encode(),
- ret["O_content"])
+ self.expect_gdbremote_sequence()
+
+ output = self.get_all_output_via_vStdio(
+ lambda output: output.count(b"PID: ") >= 2)
+ self.assertEqual(output.count(b"PID: "), 2)
+ self.assertIn("PID: {}".format(int(parent_pid, 16)).encode(), output)
+ self.assertIn("PID: {}".format(int(child_pid, 16)).encode(), output)
More information about the lldb-commits
mailing list