diff options
Diffstat (limited to 'packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py')
-rw-r--r-- | packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py | 72 |
1 files changed, 50 insertions, 22 deletions
diff --git a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py index b2b54e3f03942..74e4849b0cb6f 100644 --- a/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py +++ b/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py @@ -1,7 +1,6 @@ from __future__ import print_function - import sys import unittest2 @@ -10,6 +9,7 @@ from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil + class TestGdbRemote_qThreadStopInfo(gdbremote_testcase.GdbRemoteTestCaseBase): mydir = TestBase.compute_mydir(__file__) @@ -17,27 +17,36 @@ class TestGdbRemote_qThreadStopInfo(gdbremote_testcase.GdbRemoteTestCaseBase): def gather_stop_replies_via_qThreadStopInfo(self, thread_count): # Set up the inferior args. - inferior_args=[] + inferior_args = [] for i in range(thread_count - 1): inferior_args.append("thread:new") inferior_args.append("sleep:10") - procs = self.prep_debug_monitor_and_inferior(inferior_args=inferior_args) + procs = self.prep_debug_monitor_and_inferior( + inferior_args=inferior_args) # Assumes test_sequence has anything added needed to setup the initial state. # (Like optionally enabling QThreadsInStopReply.) self.test_sequence.add_log_lines([ "read packet: $c#63" - ], True) + ], True) context = self.expect_gdbremote_sequence() self.assertIsNotNone(context) # Give threads time to start up, then break. time.sleep(1) self.reset_test_sequence() - self.test_sequence.add_log_lines([ - "read packet: {}".format(chr(3)), - {"direction":"send", "regex":r"^\$T([0-9a-fA-F]+)([^#]+)#[0-9a-fA-F]{2}$", "capture":{1:"stop_result", 2:"key_vals_text"} }, - ], True) + self.test_sequence.add_log_lines( + [ + "read packet: {}".format( + chr(3)), + { + "direction": "send", + "regex": r"^\$T([0-9a-fA-F]+)([^#]+)#[0-9a-fA-F]{2}$", + "capture": { + 1: "stop_result", + 2: "key_vals_text"}}, + ], + True) context = self.expect_gdbremote_sequence() self.assertIsNotNone(context) @@ -52,10 +61,17 @@ class TestGdbRemote_qThreadStopInfo(gdbremote_testcase.GdbRemoteTestCaseBase): for thread in threads: # Run the qThreadStopInfo command. self.reset_test_sequence() - self.test_sequence.add_log_lines([ - "read packet: $qThreadStopInfo{:x}#00".format(thread), - {"direction":"send", "regex":r"^\$T([0-9a-fA-F]+)([^#]+)#[0-9a-fA-F]{2}$", "capture":{1:"stop_result", 2:"key_vals_text"} }, - ], True) + self.test_sequence.add_log_lines( + [ + "read packet: $qThreadStopInfo{:x}#00".format(thread), + { + "direction": "send", + "regex": r"^\$T([0-9a-fA-F]+)([^#]+)#[0-9a-fA-F]{2}$", + "capture": { + 1: "stop_result", + 2: "key_vals_text"}}, + ], + True) context = self.expect_gdbremote_sequence() self.assertIsNotNone(context) @@ -65,7 +81,8 @@ class TestGdbRemote_qThreadStopInfo(gdbremote_testcase.GdbRemoteTestCaseBase): kv_dict = self.parse_key_val_dict(key_vals_text) self.assertIsNotNone(kv_dict) - # Verify there is a thread and that it matches the expected thread id. + # Verify there is a thread and that it matches the expected thread + # id. kv_thread = kv_dict.get("thread") self.assertIsNotNone(kv_thread) kv_thread_id = int(kv_thread, 16) @@ -99,12 +116,17 @@ class TestGdbRemote_qThreadStopInfo(gdbremote_testcase.GdbRemoteTestCaseBase): self.set_inferior_startup_launch() self.qThreadStopInfo_works_for_multiple_threads(self.THREAD_COUNT) - def qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt(self, thread_count): + def qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt( + self, thread_count): (stop_replies, _) = self.gather_stop_replies_via_qThreadStopInfo(thread_count) self.assertIsNotNone(stop_replies) - no_stop_reason_count = sum(1 for stop_reason in list(stop_replies.values()) if stop_reason == 0) - with_stop_reason_count = sum(1 for stop_reason in list(stop_replies.values()) if stop_reason != 0) + no_stop_reason_count = sum( + 1 for stop_reason in list( + stop_replies.values()) if stop_reason == 0) + with_stop_reason_count = sum( + 1 for stop_reason in list( + stop_replies.values()) if stop_reason != 0) # All but one thread should report no stop reason. self.assertEqual(no_stop_reason_count, thread_count - 1) @@ -113,20 +135,25 @@ class TestGdbRemote_qThreadStopInfo(gdbremote_testcase.GdbRemoteTestCaseBase): self.assertEqual(with_stop_reason_count, 1) @debugserver_test - def test_qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt_debugserver(self): + def test_qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt_debugserver( + self): self.init_debugserver_test() self.build() self.set_inferior_startup_launch() - self.qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt(self.THREAD_COUNT) + self.qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt( + self.THREAD_COUNT) @llgs_test - def test_qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt_llgs(self): + def test_qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt_llgs( + self): self.init_llgs_test() self.build() self.set_inferior_startup_launch() - self.qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt(self.THREAD_COUNT) + self.qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt( + self.THREAD_COUNT) - def qThreadStopInfo_has_valid_thread_names(self, thread_count, expected_thread_name): + def qThreadStopInfo_has_valid_thread_names( + self, thread_count, expected_thread_name): (_, thread_dicts) = self.gather_stop_replies_via_qThreadStopInfo(thread_count) self.assertIsNotNone(thread_dicts) @@ -143,7 +170,8 @@ class TestGdbRemote_qThreadStopInfo(gdbremote_testcase.GdbRemoteTestCaseBase): self.set_inferior_startup_launch() self.qThreadStopInfo_has_valid_thread_names(self.THREAD_COUNT, "a.out") - @skipUnlessPlatform(["linux"]) # test requires OS with set, equal thread names by default. + # test requires OS with set, equal thread names by default. + @skipUnlessPlatform(["linux"]) @llgs_test def test_qThreadStopInfo_has_valid_thread_names_llgs(self): self.init_llgs_test() |