Differential D61687 Diff 200160 packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py
Changeset View
Changeset View
Standalone View
Standalone View
packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py
from __future__ import print_function | from __future__ import print_function | ||||
import gdbremote_testcase | import gdbremote_testcase | ||||
import lldbgdbserverutils | import lldbgdbserverutils | ||||
from lldbsuite.test.decorators import * | from lldbsuite.test.decorators import * | ||||
from lldbsuite.test.lldbtest import * | from lldbsuite.test.lldbtest import * | ||||
from lldbsuite.test import lldbutil | from lldbsuite.test import lldbutil | ||||
class TestGdbRemoteKill(gdbremote_testcase.GdbRemoteTestCaseBase): | class TestGdbRemoteKill(gdbremote_testcase.GdbRemoteTestCaseBase): | ||||
mydir = TestBase.compute_mydir(__file__) | mydir = TestBase.compute_mydir(__file__) | ||||
@skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet | @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet | ||||
def attach_commandline_kill_after_initial_stop(self): | def attach_commandline_kill_after_initial_stop(self): | ||||
reg_expr = r"^\$[XW][0-9a-fA-F]+([^#]*)#[0-9A-Fa-f]{2}" | |||||
clayborg: Just make one if there can be two letters?:
reg_expr = r"^\$[XW][0-9a-fA-F]+([^#]*)#[0-9A-Fa… | |||||
procs = self.prep_debug_monitor_and_inferior() | procs = self.prep_debug_monitor_and_inferior() | ||||
self.test_sequence.add_log_lines([ | self.test_sequence.add_log_lines([ | ||||
"read packet: $k#6b", | "read packet: $k#6b", | ||||
{"direction": "send", "regex": r"^\$X[0-9a-fA-F]+([^#]*)#[0-9A-Fa-f]{2}"}, | {"direction": "send", "regex": reg_expr}, | ||||
], True) | ], True) | ||||
If I understand correctly, the regexes differ only in the first letter. If that's the case, then you could just factor out the rest of the regex and just compute the letter differently: stop_type = 'W' if windows else 'X' reg_expr = r"^\${}...".format(stop_type) labath: If I understand correctly, the regexes differ only in the first letter. If that's the case… | |||||
Remove clayborg: Remove | |||||
if self.stub_sends_two_stop_notifications_on_kill: | if self.stub_sends_two_stop_notifications_on_kill: | ||||
# Add an expectation for a second X result for stubs that send two | # Add an expectation for a second X result for stubs that send two | ||||
# of these. | # of these. | ||||
self.test_sequence.add_log_lines([ | self.test_sequence.add_log_lines([ | ||||
{"direction": "send", "regex": r"^\$X[0-9a-fA-F]+([^#]*)#[0-9A-Fa-f]{2}"}, | {"direction": "send", "regex": reg_expr}, | ||||
], True) | ], True) | ||||
self.expect_gdbremote_sequence() | self.expect_gdbremote_sequence() | ||||
# Wait a moment for completed and now-detached inferior process to | # Wait a moment for completed and now-detached inferior process to | ||||
# clear. | # clear. | ||||
time.sleep(1) | time.sleep(1) | ||||
Show All 24 Lines |
Just make one if there can be two letters?:
reg_expr = r"^\$[XW][0-9a-fA-F]+([^#]*)#[0-9A-Fa-f]{2}"