From: Jan Kratochvil Date: Mon, 13 Sep 2021 05:35:12 +0000 (+0200) Subject: [lldb] [testsuite] Fix false failures on "\n" regex match X-Git-Tag: upstream/15.0.7~31643 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ff94f6024082ecd6b8a236b0953d3ce2d240cc64;p=platform%2Fupstream%2Fllvm.git [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' --- 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):