[Lldb-commits] [lldb] 6c7efe2 - [lldb][NFC] Fix expect calls with wrong order of 'substrs' items for D73766

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 31 08:55:36 PST 2020


Author: Raphael Isemann
Date: 2020-01-31T17:54:18+01:00
New Revision: 6c7efe2eecf1495d2416ebc485025859d9dee74a

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

LOG: [lldb][NFC] Fix expect calls with wrong order of 'substrs' items for D73766

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/command/script/TestCommandScript.py
    lldb/packages/Python/lldbsuite/test/commands/help/TestHelp.py
    lldb/packages/Python/lldbsuite/test/commands/platform/process/TestProcessList.py
    lldb/packages/Python/lldbsuite/test/commands/watchpoints/watchpoint_commands/command/TestWatchpointCommandPython.py
    lldb/packages/Python/lldbsuite/test/commands/watchpoints/watchpoint_commands/condition/TestWatchpointConditionCmd.py
    lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py
    lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/TestDataFormatterNSString.py
    lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/TestDataFormatterLibcxxSet.py
    lldb/packages/Python/lldbsuite/test/functionalities/multiword-commands/TestMultiWordCommands.py
    lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestConstStrings.py
    lldb/packages/Python/lldbsuite/test/types/AbstractBase.py
    lldb/packages/Python/lldbsuite/test/types/TestCharType.py
    lldb/packages/Python/lldbsuite/test/types/TestCharTypeExpr.py
    lldb/packages/Python/lldbsuite/test/types/TestIntegerType.py
    lldb/packages/Python/lldbsuite/test/types/TestIntegerTypeExpr.py
    lldb/packages/Python/lldbsuite/test/types/TestShortType.py
    lldb/packages/Python/lldbsuite/test/types/TestShortTypeExpr.py

Removed: 
    


################################################################################
diff  --git a/lldb/packages/Python/lldbsuite/test/commands/command/script/TestCommandScript.py b/lldb/packages/Python/lldbsuite/test/commands/command/script/TestCommandScript.py
index de449612a37e..b103298f24e1 100644
--- a/lldb/packages/Python/lldbsuite/test/commands/command/script/TestCommandScript.py
+++ b/lldb/packages/Python/lldbsuite/test/commands/command/script/TestCommandScript.py
@@ -86,12 +86,12 @@ def cleanup():
                         substrs=["Python command defined by @lldb.command"])
 
         self.expect("help",
-                    substrs=['For more information run',
-                             'welcome'] + decorated_commands)
+                    substrs=['For more information run']
+                             + decorated_commands + ['welcome'])
 
         self.expect("help -a",
-                    substrs=['For more information run',
-                             'welcome'] + decorated_commands)
+                    substrs=['For more information run']
+                             + decorated_commands + ['welcome'])
 
         self.expect("help -u", matching=False,
                     substrs=['For more information run'])

diff  --git a/lldb/packages/Python/lldbsuite/test/commands/help/TestHelp.py b/lldb/packages/Python/lldbsuite/test/commands/help/TestHelp.py
index 31656af633cc..f671fc7ad5f4 100644
--- a/lldb/packages/Python/lldbsuite/test/commands/help/TestHelp.py
+++ b/lldb/packages/Python/lldbsuite/test/commands/help/TestHelp.py
@@ -78,7 +78,7 @@ def version_number_string(self):
     def test_help_arch(self):
         """Test 'help arch' which should list of supported architectures."""
         self.expect("help arch",
-                    substrs=['arm', 'x86_64', 'i386'])
+                    substrs=['arm', 'i386', 'x86_64'])
 
     @no_debug_info_test
     def test_help_version(self):

diff  --git a/lldb/packages/Python/lldbsuite/test/commands/platform/process/TestProcessList.py b/lldb/packages/Python/lldbsuite/test/commands/platform/process/TestProcessList.py
index 102d6f92dd16..d20f6d6a5fea 100644
--- a/lldb/packages/Python/lldbsuite/test/commands/platform/process/TestProcessList.py
+++ b/lldb/packages/Python/lldbsuite/test/commands/platform/process/TestProcessList.py
@@ -29,4 +29,4 @@ def test_process_list_with_args(self):
         self.addTearDownHook(self.cleanupSubprocesses)
 
         self.expect("platform process list -v",
-                    substrs=["TestProcess arg1 --arg2 arg3", str(popen.pid)])
+                    substrs=[str(popen.pid), "TestProcess arg1 --arg2 arg3"])

diff  --git a/lldb/packages/Python/lldbsuite/test/commands/watchpoints/watchpoint_commands/command/TestWatchpointCommandPython.py b/lldb/packages/Python/lldbsuite/test/commands/watchpoints/watchpoint_commands/command/TestWatchpointCommandPython.py
index c72a535c51a3..956ec29809c8 100644
--- a/lldb/packages/Python/lldbsuite/test/commands/watchpoints/watchpoint_commands/command/TestWatchpointCommandPython.py
+++ b/lldb/packages/Python/lldbsuite/test/commands/watchpoints/watchpoint_commands/command/TestWatchpointCommandPython.py
@@ -87,8 +87,8 @@ def test_watchpoint_command(self):
 
         # Check that the watchpoint snapshoting mechanism is working.
         self.expect("watchpoint list -v",
-                    substrs=['old value:', ' = 0',
-                             'new value:', ' = 1'])
+                    substrs=['old value: 0',
+                             'new value: 1'])
 
         # The watchpoint command "forced" our global variable 'cookie' to
         # become 777.

diff  --git a/lldb/packages/Python/lldbsuite/test/commands/watchpoints/watchpoint_commands/condition/TestWatchpointConditionCmd.py b/lldb/packages/Python/lldbsuite/test/commands/watchpoints/watchpoint_commands/condition/TestWatchpointConditionCmd.py
index 0605aae52909..f53da3a52193 100644
--- a/lldb/packages/Python/lldbsuite/test/commands/watchpoints/watchpoint_commands/condition/TestWatchpointConditionCmd.py
+++ b/lldb/packages/Python/lldbsuite/test/commands/watchpoints/watchpoint_commands/condition/TestWatchpointConditionCmd.py
@@ -70,7 +70,7 @@ def test_watchpoint_cond(self):
         # Use the '-v' option to do verbose listing of the watchpoint.
         # The hit count should be 0 initially.
         self.expect("watchpoint list -v",
-                    substrs=['hit_count = 0', 'global==5'])
+                    substrs=['global==5', 'hit_count = 0'])
 
         self.runCmd("process continue")
 

diff  --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py
index 76fefda8a9fb..506a9d22050a 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py
@@ -62,5 +62,5 @@ def inlined_breakpoints(self):
         # And it should break at basic_type.cpp:176.
         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
                     substrs=['stopped',
-                             'stop reason = breakpoint',
-                             'basic_type.cpp:%d' % self.line])
+                             'basic_type.cpp:%d' % self.line,
+                             'stop reason = breakpoint',])

diff  --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/TestDataFormatterNSString.py b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/TestDataFormatterNSString.py
index 6480025e2e17..4ef0a5957503 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/TestDataFormatterNSString.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/TestDataFormatterNSString.py
@@ -77,7 +77,7 @@ def rdar11106605_commands(self):
 
     def nsstring_data_formatter_commands(self):
         self.expect('frame variable str0 str1 str2 str3 str4 str5 str6 str8 str9 str10 str11 label1 label2 processName str12',
-                    substrs=['(NSString *) str1 = ', ' @"A rather short ASCII NSString object is here"',
+                    substrs=[
                              # '(NSString *) str0 = ',' @"255"',
                              '(NSString *) str1 = ', ' @"A rather short ASCII NSString object is here"',
                              '(NSString *) str2 = ', ' @"A rather short UTF8 NSString object is here"',

diff  --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/TestDataFormatterLibcxxSet.py b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/TestDataFormatterLibcxxSet.py
index 738df85d0519..e3827bbb632c 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/TestDataFormatterLibcxxSet.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/TestDataFormatterLibcxxSet.py
@@ -102,17 +102,17 @@ def cleanup():
         self.expect(
             "frame variable ss",
             substrs=["size=4",
-                     '[2] = "b"',
-                     '[3] = "c"',
                      '[0] = "a"',
-                     '[1] = "a very long string is right here"'])
+                     '[1] = "a very long string is right here"',
+                     '[2] = "b"',
+                     '[3] = "c"'])
         self.expect(
             "p ss",
             substrs=["size=4",
-                     '[2] = "b"',
-                     '[3] = "c"',
                      '[0] = "a"',
-                     '[1] = "a very long string is right here"'])
+                     '[1] = "a very long string is right here"',
+                     '[2] = "b"',
+                     '[3] = "c"'])
         self.expect("frame variable ss[2]", substrs=[' = "b"'])
         lldbutil.continue_to_breakpoint(process, bkpt)
         self.expect(

diff  --git a/lldb/packages/Python/lldbsuite/test/functionalities/multiword-commands/TestMultiWordCommands.py b/lldb/packages/Python/lldbsuite/test/functionalities/multiword-commands/TestMultiWordCommands.py
index 80b144f58d57..00c711bc11f9 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/multiword-commands/TestMultiWordCommands.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/multiword-commands/TestMultiWordCommands.py
@@ -15,8 +15,8 @@ def test_ambiguous_subcommand(self):
         self.expect("platform s", error=True,
                     substrs=["ambiguous command 'platform s'. Possible completions:",
                              "\tselect\n",
-                             "\tshell\n",
-                             "\tsettings\n"])
+                             "\tsettings\n",
+                             "\tshell\n"])
 
     @no_debug_info_test
     def test_empty_subcommand(self):

diff  --git a/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestConstStrings.py b/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestConstStrings.py
index 6e8e9898e198..db0d1bbf8ab3 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestConstStrings.py
+++ b/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestConstStrings.py
@@ -41,8 +41,8 @@ def test_break(self):
 
         self.runCmd("run", RUN_SUCCEEDED)
         self.expect("process status", STOPPED_DUE_TO_BREAKPOINT,
-                    substrs=[" at %s:%d" % (self.main_source, self.line),
-                             "stop reason = breakpoint"])
+                    substrs=["stop reason = breakpoint",
+                             " at %s:%d" % (self.main_source, self.line)])
 
         self.expect('expression (int)[str compare:@"hello"]',
                     startstr="(int) $0 = 0")

diff  --git a/lldb/packages/Python/lldbsuite/test/types/AbstractBase.py b/lldb/packages/Python/lldbsuite/test/types/AbstractBase.py
index 2ced13937721..f2abfa092a7e 100644
--- a/lldb/packages/Python/lldbsuite/test/types/AbstractBase.py
+++ b/lldb/packages/Python/lldbsuite/test/types/AbstractBase.py
@@ -167,8 +167,8 @@ def generic_type_tester(
 
         self.runCmd("run", RUN_SUCCEEDED)
         self.expect("process status", STOPPED_DUE_TO_BREAKPOINT,
-                    substrs=[" at basic_type.cpp:%d" % break_line,
-                             "stop reason = breakpoint"])
+                    substrs=["stop reason = breakpoint",
+                             " at basic_type.cpp:%d" % break_line,])
 
         #self.runCmd("frame variable --show-types")
 
@@ -263,8 +263,8 @@ def generic_type_expr_tester(
 
         self.runCmd("run", RUN_SUCCEEDED)
         self.expect("process status", STOPPED_DUE_TO_BREAKPOINT,
-                    substrs=[" at basic_type.cpp:%d" % break_line,
-                             "stop reason = breakpoint"])
+                    substrs=["stop reason = breakpoint",
+                             " at basic_type.cpp:%d" % break_line])
 
         #self.runCmd("frame variable --show-types")
 

diff  --git a/lldb/packages/Python/lldbsuite/test/types/TestCharType.py b/lldb/packages/Python/lldbsuite/test/types/TestCharType.py
index bc568702c669..9ba49fd96b1a 100644
--- a/lldb/packages/Python/lldbsuite/test/types/TestCharType.py
+++ b/lldb/packages/Python/lldbsuite/test/types/TestCharType.py
@@ -13,20 +13,20 @@ class CharTypeTestCase(AbstractBase.GenericTester):
 
     def test_char_type(self):
         """Test that char-type variables are displayed correctly."""
-        self.build_and_run('char.cpp', set(['char']), qd=True)
+        self.build_and_run('char.cpp', ['char'], qd=True)
 
     @skipUnlessDarwin
     def test_char_type_from_block(self):
         """Test that char-type variables are displayed correctly from a block."""
-        self.build_and_run('char.cpp', set(['char']), bc=True, qd=True)
+        self.build_and_run('char.cpp', ['char'], bc=True, qd=True)
 
     def test_unsigned_char_type(self):
         """Test that 'unsigned_char'-type variables are displayed correctly."""
         self.build_and_run(
-            'unsigned_char.cpp', set(['unsigned', 'char']), qd=True)
+            'unsigned_char.cpp', ['unsigned', 'char'], qd=True)
 
     @skipUnlessDarwin
     def test_unsigned_char_type_from_block(self):
         """Test that 'unsigned char'-type variables are displayed correctly from a block."""
         self.build_and_run(
-            'unsigned_char.cpp', set(['unsigned', 'char']), bc=True, qd=True)
+            'unsigned_char.cpp', ['unsigned', 'char'], bc=True, qd=True)

diff  --git a/lldb/packages/Python/lldbsuite/test/types/TestCharTypeExpr.py b/lldb/packages/Python/lldbsuite/test/types/TestCharTypeExpr.py
index 63ddc1451b95..b1708f25d260 100644
--- a/lldb/packages/Python/lldbsuite/test/types/TestCharTypeExpr.py
+++ b/lldb/packages/Python/lldbsuite/test/types/TestCharTypeExpr.py
@@ -13,20 +13,20 @@ class CharTypeExprTestCase(AbstractBase.GenericTester):
 
     def test_char_type(self):
         """Test that char-type variable expressions are evaluated correctly."""
-        self.build_and_run_expr('char.cpp', set(['char']), qd=True)
+        self.build_and_run_expr('char.cpp', ['char'], qd=True)
 
     @skipUnlessDarwin
     def test_char_type_from_block(self):
         """Test that char-type variables are displayed correctly from a block."""
-        self.build_and_run_expr('char.cpp', set(['char']), bc=True, qd=True)
+        self.build_and_run_expr('char.cpp', ['char'], bc=True, qd=True)
 
     def test_unsigned_char_type(self):
         """Test that 'unsigned_char'-type variable expressions are evaluated correctly."""
         self.build_and_run_expr(
-            'unsigned_char.cpp', set(['unsigned', 'char']), qd=True)
+            'unsigned_char.cpp', ['unsigned', 'char'], qd=True)
 
     @skipUnlessDarwin
     def test_unsigned_char_type_from_block(self):
         """Test that 'unsigned char'-type variables are displayed correctly from a block."""
         self.build_and_run_expr(
-            'unsigned_char.cpp', set(['unsigned', 'char']), bc=True, qd=True)
+            'unsigned_char.cpp', ['unsigned', 'char'], bc=True, qd=True)

diff  --git a/lldb/packages/Python/lldbsuite/test/types/TestIntegerType.py b/lldb/packages/Python/lldbsuite/test/types/TestIntegerType.py
index 549b37af3e8c..2b1fd8e84cf0 100644
--- a/lldb/packages/Python/lldbsuite/test/types/TestIntegerType.py
+++ b/lldb/packages/Python/lldbsuite/test/types/TestIntegerType.py
@@ -13,19 +13,19 @@ class IntegerTypesTestCase(AbstractBase.GenericTester):
 
     def test_int_type(self):
         """Test that int-type variables are displayed correctly."""
-        self.build_and_run('int.cpp', set(['int']))
+        self.build_and_run('int.cpp', ['int'])
 
     @skipUnlessDarwin
     def test_int_type_from_block(self):
         """Test that int-type variables are displayed correctly from a block."""
-        self.build_and_run('int.cpp', set(['int']))
+        self.build_and_run('int.cpp', ['int'])
 
     def test_unsigned_int_type(self):
         """Test that 'unsigned_int'-type variables are displayed correctly."""
-        self.build_and_run('unsigned_int.cpp', set(['unsigned', 'int']))
+        self.build_and_run('unsigned_int.cpp', ['unsigned', 'int'])
 
     @skipUnlessDarwin
     def test_unsigned_int_type_from_block(self):
         """Test that 'unsigned int'-type variables are displayed correctly from a block."""
         self.build_and_run(
-            'unsigned_int.cpp', set(['unsigned', 'int']), bc=True)
+            'unsigned_int.cpp', ['unsigned', 'int'], bc=True)

diff  --git a/lldb/packages/Python/lldbsuite/test/types/TestIntegerTypeExpr.py b/lldb/packages/Python/lldbsuite/test/types/TestIntegerTypeExpr.py
index 0b258dbaa67f..4dd8b43dbe4e 100644
--- a/lldb/packages/Python/lldbsuite/test/types/TestIntegerTypeExpr.py
+++ b/lldb/packages/Python/lldbsuite/test/types/TestIntegerTypeExpr.py
@@ -15,23 +15,23 @@ class IntegerTypeExprTestCase(AbstractBase.GenericTester):
     def test_unsigned_short_type_from_block(self):
         """Test that 'unsigned short'-type variables are displayed correctly from a block."""
         self.build_and_run_expr(
-            'unsigned_short.cpp', set(['unsigned', 'short']), bc=True)
+            'unsigned_short.cpp', ['unsigned', 'short'], bc=True)
 
     def test_int_type(self):
         """Test that int-type variable expressions are evaluated correctly."""
-        self.build_and_run_expr('int.cpp', set(['int']))
+        self.build_and_run_expr('int.cpp', ['int'])
 
     @skipUnlessDarwin
     def test_int_type_from_block(self):
         """Test that int-type variables are displayed correctly from a block."""
-        self.build_and_run_expr('int.cpp', set(['int']))
+        self.build_and_run_expr('int.cpp', ['int'])
 
     def test_unsigned_int_type(self):
         """Test that 'unsigned_int'-type variable expressions are evaluated correctly."""
-        self.build_and_run_expr('unsigned_int.cpp', set(['unsigned', 'int']))
+        self.build_and_run_expr('unsigned_int.cpp', ['unsigned', 'int'])
 
     @skipUnlessDarwin
     def test_unsigned_int_type_from_block(self):
         """Test that 'unsigned int'-type variables are displayed correctly from a block."""
         self.build_and_run_expr(
-            'unsigned_int.cpp', set(['unsigned', 'int']), bc=True)
+            'unsigned_int.cpp', ['unsigned', 'int'], bc=True)

diff  --git a/lldb/packages/Python/lldbsuite/test/types/TestShortType.py b/lldb/packages/Python/lldbsuite/test/types/TestShortType.py
index d940d1ba0176..e75827f2a7ea 100644
--- a/lldb/packages/Python/lldbsuite/test/types/TestShortType.py
+++ b/lldb/packages/Python/lldbsuite/test/types/TestShortType.py
@@ -13,19 +13,19 @@ class ShortTypeTestCase(AbstractBase.GenericTester):
 
     def test_short_type(self):
         """Test that short-type variables are displayed correctly."""
-        self.build_and_run('short.cpp', set(['short']))
+        self.build_and_run('short.cpp', ['short'])
 
     @skipUnlessDarwin
     def test_short_type_from_block(self):
         """Test that short-type variables are displayed correctly from a block."""
-        self.build_and_run('short.cpp', set(['short']), bc=True)
+        self.build_and_run('short.cpp', ['short'], bc=True)
 
     def test_unsigned_short_type(self):
         """Test that 'unsigned_short'-type variables are displayed correctly."""
-        self.build_and_run('unsigned_short.cpp', set(['unsigned', 'short']))
+        self.build_and_run('unsigned_short.cpp', ['unsigned', 'short'])
 
     @skipUnlessDarwin
     def test_unsigned_short_type_from_block(self):
         """Test that 'unsigned short'-type variables are displayed correctly from a block."""
         self.build_and_run(
-            'unsigned_short.cpp', set(['unsigned', 'short']), bc=True)
+            'unsigned_short.cpp', ['unsigned', 'short'], bc=True)

diff  --git a/lldb/packages/Python/lldbsuite/test/types/TestShortTypeExpr.py b/lldb/packages/Python/lldbsuite/test/types/TestShortTypeExpr.py
index 17bcfd378e10..96df238ed225 100644
--- a/lldb/packages/Python/lldbsuite/test/types/TestShortTypeExpr.py
+++ b/lldb/packages/Python/lldbsuite/test/types/TestShortTypeExpr.py
@@ -13,20 +13,20 @@ class ShortExprTestCase(AbstractBase.GenericTester):
 
     def test_short_type(self):
         """Test that short-type variable expressions are evaluated correctly."""
-        self.build_and_run_expr('short.cpp', set(['short']))
+        self.build_and_run_expr('short.cpp', ['short'])
 
     @skipUnlessDarwin
     def test_short_type_from_block(self):
         """Test that short-type variables are displayed correctly from a block."""
-        self.build_and_run_expr('short.cpp', set(['short']), bc=True)
+        self.build_and_run_expr('short.cpp', ['short'], bc=True)
 
     def test_unsigned_short_type(self):
         """Test that 'unsigned_short'-type variable expressions are evaluated correctly."""
         self.build_and_run_expr('unsigned_short.cpp',
-                                set(['unsigned', 'short']))
+                                ['unsigned', 'short'])
 
     @skipUnlessDarwin
     def test_unsigned_short_type_from_block(self):
         """Test that 'unsigned short'-type variables are displayed correctly from a block."""
         self.build_and_run_expr(
-            'unsigned_short.cpp', set(['unsigned', 'short']), bc=True)
+            'unsigned_short.cpp', ['unsigned', 'short'], bc=True)


        


More information about the lldb-commits mailing list