[Lldb-commits] [lldb] 021a3d5 - [lldb] Start from end of previous substr when checking ordered substrs

Arthur Eubanks via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 14 11:17:08 PDT 2022


Author: Arthur Eubanks
Date: 2022-10-14T11:16:51-07:00
New Revision: 021a3d5a3f73c59d7e43857c0230e07fa602d948

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

LOG: [lldb] Start from end of previous substr when checking ordered substrs

I'm trying to add a test which tests that the same substr occurs twice in a row, but it matches even if only one of the substr occurs.

This found a bug in concurrent_base.py.

Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D135826

Added: 
    

Modified: 
    lldb/packages/Python/lldbsuite/test/concurrent_base.py
    lldb/packages/Python/lldbsuite/test/lldbtest.py
    lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py

Removed: 
    


################################################################################
diff  --git a/lldb/packages/Python/lldbsuite/test/concurrent_base.py b/lldb/packages/Python/lldbsuite/test/concurrent_base.py
index 6acd71ce9e46d..a235ceb76413f 100644
--- a/lldb/packages/Python/lldbsuite/test/concurrent_base.py
+++ b/lldb/packages/Python/lldbsuite/test/concurrent_base.py
@@ -74,9 +74,7 @@ def add_breakpoint(self, line, descriptions):
         bpno = lldbutil.run_break_set_by_file_and_line(
             self, self.filename, line, num_expected_locations=-1)
         bp = self.inferior_target.FindBreakpointByID(bpno)
-        descriptions.append(
-            ": file = 'main.cpp', line = %d" %
-            self.finish_breakpoint_line)
+        descriptions.append(": file = 'main.cpp', line = %d" % line)
         return bp
 
     def inferior_done(self):

diff  --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 1ea29b3f5a39d..2d054f971cd02 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -2358,7 +2358,7 @@ def found_str(matched):
             start = 0
             for substr in substrs:
                 index = output[start:].find(substr)
-                start = start + index if ordered and matching else 0
+                start = start + index + len(substr) if ordered and matching else 0
                 matched = index != -1
                 log_lines.append("{} sub string: \"{}\" ({})".format(
                         expecting_str, substr, found_str(matched)))

diff  --git a/lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py b/lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py
index d4d6d249ebce3..c4d4c465fedb6 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py
@@ -116,7 +116,7 @@ def cleanup():
             substrs=[
                 '(char *) $',
                 ' = ptr = ',
-                ' "1234567890123456789012345678901234567890123456789012345678901234ABC"'])
+                '"1234567890123456789012345678901234567890123456789012345678901234ABC"'])
 
         self.runCmd("type summary add -c TestPoint")
 


        


More information about the lldb-commits mailing list