[Lldb-commits] [lldb] ff94f60 - [lldb] [testsuite] Fix false failures on "\n" regex match

Jan Kratochvil via lldb-commits lldb-commits at lists.llvm.org
Sun Sep 12 22:38:03 PDT 2021


Author: Jan Kratochvil
Date: 2021-09-13T07:35:12+02:00
New Revision: ff94f6024082ecd6b8a236b0953d3ce2d240cc64

URL: https://github.com/llvm/llvm-project/commit/ff94f6024082ecd6b8a236b0953d3ce2d240cc64
DIFF: https://github.com/llvm/llvm-project/commit/ff94f6024082ecd6b8a236b0953d3ce2d240cc64.diff

LOG: [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'

Added: 
    

Modified: 
    lldb/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py

Removed: 
    


################################################################################
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 4323e97126d01..12dafd15283bc 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 @@ def add_log_lines(self, log_lines, remote_input_is_read):
 
                     # 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):


        


More information about the lldb-commits mailing list