[Lldb-commits] [PATCH] D98749: [lldb] [test] Fix TestGdbRemote_vContThreads.py logic
Michał Górny via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Mar 16 16:25:02 PDT 2021
mgorny created this revision.
mgorny added reviewers: labath, emaste, krytarowski.
mgorny requested review of this revision.
The TestGdbRemote_vContThreads.py were introduced to test NetBSD process
plugin's capability of sending per-thread and per-process signals.
However, at some point the tests started failing. From retrospective,
it is possible that they were relying on some bug in the plugin's
original signal handling.
Fix the tests not to expect the process to terminate after receiving
the signals. Instead, scan for output indicating that the signals were
received and match thread IDs in it. Enable 'signal to all threads'
test everywhere as it works fine on Linux. Add a new test for vCont
packet without specific thread IDs.
While this does not fix all the problems on NetBSD, it enables a subset
of the tests on other systems. I am planning to add more tests
to the group while implementing multiprocess extension for vCont.
https://reviews.llvm.org/D98749
Files:
lldb/test/API/tools/lldb-server/TestGdbRemote_vContThreads.py
Index: lldb/test/API/tools/lldb-server/TestGdbRemote_vContThreads.py
===================================================================
--- lldb/test/API/tools/lldb-server/TestGdbRemote_vContThreads.py
+++ lldb/test/API/tools/lldb-server/TestGdbRemote_vContThreads.py
@@ -31,6 +31,28 @@
self.reset_test_sequence()
return threads
+ @expectedFailureNetBSD
+ def test_signal_process_without_tid(self):
+ self.build()
+ self.set_inferior_startup_launch()
+
+ threads = self.start_threads(1)
+ self.test_sequence.add_log_lines([
+ "read packet: $vCont;C{0:x}#00".format(
+ lldbutil.get_signal_number('SIGUSR1')),
+ {"type": "output_match",
+ "regex": self.maybe_strict_output_regex(
+ r"received SIGUSR1 on thread id: ([0-9a-f]+)\r\n"
+ r"received SIGUSR1 on thread id: ([0-9a-f]+)\r\n"),
+ "capture": {1: "tid1", 2: "tid2"},
+ },
+ ], True)
+
+ context = self.expect_gdbremote_sequence()
+ self.assertIsNotNone(context)
+ tids = sorted(int(context[x], 16) for x in ("tid1", "tid2"))
+ self.assertEqual(tids, sorted(threads))
+
@skipUnlessPlatform(["netbsd"])
@expectedFailureNetBSD
def test_signal_one_thread(self):
@@ -42,13 +64,17 @@
self.test_sequence.add_log_lines([
"read packet: $vCont;C{0:x}:{1:x};c#00".format(
lldbutil.get_signal_number('SIGUSR1'), threads[0]),
- {"direction": "send", "regex": r"^\$W00#b7$"},
+ {"type": "output_match",
+ "regex": self.maybe_strict_output_regex(
+ r"received SIGUSR1 on thread id: ([0-9a-f]+)\r\n"),
+ "capture": {1: "tid"},
+ },
], True)
context = self.expect_gdbremote_sequence()
self.assertIsNotNone(context)
+ self.assertEqual(int(context["tid"], 16), threads[0])
- @skipUnlessPlatform(["netbsd"])
@expectedFailureNetBSD
def test_signal_all_threads(self):
self.build()
@@ -60,11 +86,18 @@
"read packet: $vCont;C{0:x}:{1:x};C{0:x}:{2:x}#00".format(
lldbutil.get_signal_number('SIGUSR1'),
threads[0], threads[1]),
- {"direction": "send", "regex": r"^\$W00#b7$"},
+ {"type": "output_match",
+ "regex": self.maybe_strict_output_regex(
+ r"received SIGUSR1 on thread id: ([0-9a-f]+)\r\n"
+ r"received SIGUSR1 on thread id: ([0-9a-f]+)\r\n"),
+ "capture": {1: "tid1", 2: "tid2"},
+ },
], True)
context = self.expect_gdbremote_sequence()
self.assertIsNotNone(context)
+ tids = sorted(int(context[x], 16) for x in ("tid1", "tid2"))
+ self.assertEqual(tids, sorted(threads))
@skipUnlessPlatform(["netbsd"])
def test_signal_two_of_three_threads(self):
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98749.331125.patch
Type: text/x-patch
Size: 2956 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210316/ede4ea91/attachment-0001.bin>
More information about the lldb-commits
mailing list