From ff94f6024082ecd6b8a236b0953d3ce2d240cc64 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Mon, 13 Sep 2021 07:35:12 +0200 Subject: [PATCH] [lldb] [testsuite] Fix false failures on "\n" regex match Regex is matching a binary so it needs `re.DOTALL`. vFile:fstat packet data ATTACHMENT is not hex-encoded but it is only escaped. It is difficult to reproduce, it came from buildbot: https://lab.llvm.org/staging/#/builders/16/builds/10597 ******************** TEST 'lldb-api :: tools/lldb-server/TestGdbRemotePlatformFile.py' FAILED ******************** FAIL: test_platform_file_fstat_llgs (TestGdbRemotePlatformFile.TestGdbRemotePlatformFile) ---------------------------------------------------------------------- Traceback (most recent call last): File "lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py", line 52, in test_method return attrvalue(self) File "lldb/test/API/tools/lldb-server/TestGdbRemotePlatformFile.py", line 259, in test_platform_file_fstat context = self.expect_gdbremote_sequence() File "lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py", line 621, in expect_gdbremote_sequence return expect_lldb_gdbserver_replay( File "lldb/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py", line 198, in expect_lldb_gdbserver_replay context = sequence_entry.assert_match( File "lldb/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py", line 479, in assert_match return self._assert_regex_match(asserter, actual_packet, context) File "lldb/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py", line 446, in _assert_regex_match asserter.fail( AssertionError: regex '^\$F([0-9a-fA-F]+);(.*)#[0-9a-fA-F]{2}$' failed to match against content '$F40;^@^@^@ ^@ ^C<8d>^@^@<81><80>^@^@^@^A^@^@^CX^@^@^CX^@^@^@^@^@^@^@^@^@^@^@^W^@^@^@^@^@^@^P^@^@^@^@^@^@^@^@ a=XXa=XXa=XX#6b' --- .../Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py index 4323e97..12dafd1 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py @@ -759,7 +759,7 @@ class GdbRemoteTestSequence(object): # Compile the regex. if regex and (isinstance(regex, str)): - regex = re.compile(regex) + regex = re.compile(regex, re.DOTALL) if _is_packet_lldb_gdbserver_input( direction, remote_input_is_read): -- 2.7.4