OSDN Git Service

[lldb/Test] Fix substrs order in self.expect for more tests (NFC)
authorJonas Devlieghere <jonas@devlieghere.com>
Fri, 31 Jan 2020 18:28:15 +0000 (10:28 -0800)
committerJonas Devlieghere <jonas@devlieghere.com>
Fri, 31 Jan 2020 18:29:33 +0000 (10:29 -0800)
Currently the substrs parameter takes a list of strings that need to be
found but the ordering isn't checked. D73766 might change that so this
changes a several tests so that the order of the strings in the substrs
list is in the order in which they appear in the output.

lldb/packages/Python/lldbsuite/test/commands/expression/issue_11588/Test11588.py
lldb/packages/Python/lldbsuite/test/commands/frame/recognizer/TestFrameRecognizer.py
lldb/packages/Python/lldbsuite/test/commands/settings/TestSettings.py
lldb/packages/Python/lldbsuite/test/commands/target/basic/TestTargetCommand.py
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py

index abff18f..4f50e1c 100644 (file)
@@ -60,7 +60,8 @@ class Issue11581TestCase(TestBase):
             self.expect("expr --show-types -- *(StgClosure*)$r14",
                         substrs=["(StgClosure) $",
                                  "(StgClosure *) &$", "0x",
+                                 hex(addr)[2:].rstrip("L"),
                                  "addr = ",
+                                 str(addr),
                                  "load_address = ",
-                                 hex(addr)[2:].rstrip("L"),
                                  str(addr)])
index 2ecbe1e..39ca761 100644 (file)
@@ -34,10 +34,12 @@ class FrameRecognizerTestCase(TestBase):
 
         self.runCmd("frame recognizer add -l recognizer.MyOtherFrameRecognizer -s a.out -n bar -x")
 
-        self.expect("frame recognizer list",
-                    substrs=['0: recognizer.MyFrameRecognizer, module a.out, function foo',
-                             '1: recognizer.MyOtherFrameRecognizer, module a.out, function bar (regexp)'
-                    ])
+        self.expect(
+            "frame recognizer list",
+            substrs=[
+                '1: recognizer.MyOtherFrameRecognizer, module a.out, function bar (regexp)',
+                '0: recognizer.MyFrameRecognizer, module a.out, function foo'
+            ])
 
         self.runCmd("frame recognizer delete 0")
 
index 1130821..2bc9a91 100644 (file)
@@ -485,7 +485,7 @@ class SettingsCommandTestCase(TestBase):
 
     def test_settings_list(self):
         # List settings (and optionally test the filter to only show 'target' settings).
-        self.expect("settings list target", substrs=["language", "arg0", "detach-on-error"])
+        self.expect("settings list target", substrs=["arg0", "detach-on-error", "language"])
         self.expect("settings list target", matching=False, substrs=["packet-timeout"])
         self.expect("settings list", substrs=["language", "arg0", "detach-on-error", "packet-timeout"])
 
@@ -537,33 +537,34 @@ class SettingsCommandTestCase(TestBase):
                              "term-width",
                              "thread-format",
                              "use-external-editor",
+                             "target.breakpoints-use-platform-avoid-list",
                              "target.default-arch",
-                             "target.move-to-nearest-code",
-                             "target.expr-prefix",
-                             "target.language",
-                             "target.prefer-dynamic-value",
+                             "target.disable-aslr",
+                             "target.disable-stdio",
+                             "target.x86-disassembly-flavor",
                              "target.enable-synthetic-value",
-                             "target.skip-prologue",
-                             "target.source-map",
-                             "target.exec-search-paths",
-                             "target.max-children-count",
-                             "target.max-string-summary-length",
-                             "target.breakpoints-use-platform-avoid-list",
-                             "target.run-args",
                              "target.env-vars",
+                             "target.error-path",
+                             "target.exec-search-paths",
+                             "target.expr-prefix",
+                             "target.hex-immediate-style",
                              "target.inherit-env",
                              "target.input-path",
+                             "target.language",
+                             "target.max-children-count",
+                             "target.max-string-summary-length",
+                             "target.move-to-nearest-code",
                              "target.output-path",
-                             "target.error-path",
-                             "target.disable-aslr",
-                             "target.disable-stdio",
-                             "target.x86-disassembly-flavor",
+                             "target.prefer-dynamic-value",
+                             "target.run-args",
+                             "target.skip-prologue",
+                             "target.source-map",
                              "target.use-hex-immediates",
-                             "target.hex-immediate-style",
                              "target.process.disable-memory-cache",
                              "target.process.extra-startup-command",
+                             "target.process.thread.trace-thread",
                              "target.process.thread.step-avoid-regexp",
-                             "target.process.thread.trace-thread"])
+                             ])
 
     # settings under an ".experimental" domain should have two properties:
     #   1. If the name does not exist with "experimental" in the name path,
index 6152a6a..81d7804 100644 (file)
@@ -103,13 +103,13 @@ class targetCommandTestCase(TestBase):
 
         self.runCmd("target select %d" % (base + 2))
         self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
-                    substrs=['c.c:%d' % self.line_c,
-                             'stop reason = breakpoint'])
+                    substrs=['stop reason = breakpoint' ,'c.c:%d' % self.line_c
+                             ])
 
         self.runCmd("target select %d" % (base + 1))
         self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
-                    substrs=['b.c:%d' % self.line_b,
-                             'stop reason = breakpoint'])
+                    substrs=['stop reason = breakpoint', 'b.c:%d' % self.line_b
+                             ])
 
         self.runCmd("target list")
 
@@ -246,9 +246,10 @@ class targetCommandTestCase(TestBase):
         # compile unit.
         self.expect("target variable",
                     substrs=['my_global_char',
+                             'my_static_int',
                              'my_global_str',
                              'my_global_str_ptr',
-                             'my_static_int'])
+                             ])
 
         self.expect(
             "target variable my_global_str",
index 90d182b..f778b8e 100644 (file)
@@ -93,10 +93,13 @@ class HardwareBreakpointMultiThreadTestCase(TestBase):
 
             # We should be stopped in hw_break_function
             # The stop reason of the thread should be breakpoint.
-            self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+            self.expect(
+                "thread list",
+                STOPPED_DUE_TO_BREAKPOINT,
                 substrs=[
+                    'hw_break_function',
                     'stop reason = breakpoint',
-                    'hw_break_function'])
+                ])
 
             # Continue the loop and test that we are stopped 4 times.
             count += 1