[Lldb-commits] [lldb] 2c19d05 - [lldb/Test] Fix substrs order in self.expect for more tests (NFC)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 31 10:29:39 PST 2020


Author: Jonas Devlieghere
Date: 2020-01-31T10:29:33-08:00
New Revision: 2c19d05ae91e263585cd4633788d83563e67157a

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

LOG: [lldb/Test] Fix substrs order in self.expect for more tests (NFC)

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.

Added: 
    

Modified: 
    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

Removed: 
    


################################################################################
diff  --git a/lldb/packages/Python/lldbsuite/test/commands/expression/issue_11588/Test11588.py b/lldb/packages/Python/lldbsuite/test/commands/expression/issue_11588/Test11588.py
index abff18f3fa18..4f50e1cd1add 100644
--- a/lldb/packages/Python/lldbsuite/test/commands/expression/issue_11588/Test11588.py
+++ b/lldb/packages/Python/lldbsuite/test/commands/expression/issue_11588/Test11588.py
@@ -60,7 +60,8 @@ def cleanup():
             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)])

diff  --git a/lldb/packages/Python/lldbsuite/test/commands/frame/recognizer/TestFrameRecognizer.py b/lldb/packages/Python/lldbsuite/test/commands/frame/recognizer/TestFrameRecognizer.py
index 2ecbe1e4c15f..39ca7619acd0 100644
--- a/lldb/packages/Python/lldbsuite/test/commands/frame/recognizer/TestFrameRecognizer.py
+++ b/lldb/packages/Python/lldbsuite/test/commands/frame/recognizer/TestFrameRecognizer.py
@@ -34,10 +34,12 @@ def test_frame_recognizer_1(self):
 
         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")
 

diff  --git a/lldb/packages/Python/lldbsuite/test/commands/settings/TestSettings.py b/lldb/packages/Python/lldbsuite/test/commands/settings/TestSettings.py
index 1130821bac0f..2bc9a91b5bf5 100644
--- a/lldb/packages/Python/lldbsuite/test/commands/settings/TestSettings.py
+++ b/lldb/packages/Python/lldbsuite/test/commands/settings/TestSettings.py
@@ -485,7 +485,7 @@ def test_settings_with_trailing_whitespace(self):
 
     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 @@ def test_all_settings_exist(self):
                              "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,

diff  --git a/lldb/packages/Python/lldbsuite/test/commands/target/basic/TestTargetCommand.py b/lldb/packages/Python/lldbsuite/test/commands/target/basic/TestTargetCommand.py
index 6152a6a9673c..81d7804b85f2 100644
--- a/lldb/packages/Python/lldbsuite/test/commands/target/basic/TestTargetCommand.py
+++ b/lldb/packages/Python/lldbsuite/test/commands/target/basic/TestTargetCommand.py
@@ -103,13 +103,13 @@ def do_target_command(self):
 
         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 @@ def do_target_variable_command_no_fail(self, exe_name):
         # 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",

diff  --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
index 90d182bfcc89..f778b8e39e72 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
@@ -93,10 +93,13 @@ def break_multi_thread(self, removal_type, check_hw_bp=True):
 
             # 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


        


More information about the lldb-commits mailing list