[Lldb-commits] [PATCH] D73766: [RFC] Make substrs argument to self.expect ordered by default.

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 30 22:43:34 PST 2020


JDevlieghere updated this revision to Diff 241637.
JDevlieghere added a comment.

Remove debug print


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73766/new/

https://reviews.llvm.org/D73766

Files:
  lldb/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py
  lldb/packages/Python/lldbsuite/test/lldbtest.py


Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -2261,6 +2261,7 @@
             substrs=None,
             trace=False,
             error=False,
+            ordered=True,
             matching=True,
             exe=True,
             inHistory=False):
@@ -2341,8 +2342,11 @@
         # Look for sub strings, if specified.
         keepgoing = matched if matching else not matched
         if substrs and keepgoing:
+            start = 0
             for substr in substrs:
-                matched = output.find(substr) != -1
+                index = output[start:].find(substr)
+                start = start + index if ordered and matching else 0
+                matched = index != -1
                 with recording(self, trace) as sbuf:
                     print("%s sub string: %s" % (heading, substr), file=sbuf)
                     print("Matched" if matched else "Not matched", file=sbuf)
Index: lldb/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py
+++ lldb/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py
@@ -46,7 +46,7 @@
 
         self.expect(
             "thread info -s",
-            substrs=["instrumentation_class", "api_name", "class_name", "selector", "description"])
+            substrs=["api_name", "class_name", "description", "instrumentation_class", "selector"])
         self.assertEqual(thread.GetStopReason(), lldb.eStopReasonInstrumentation)
         output_lines = self.res.GetOutput().split('\n')
         json_line = '\n'.join(output_lines[2:])


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73766.241637.patch
Type: text/x-patch
Size: 1873 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200131/b14f5859/attachment.bin>


More information about the lldb-commits mailing list