[lldb/Test] Fix substrs order in self.expect for more tests (NFC)
authorJonas Devlieghere <jonas@devlieghere.com>
Fri, 31 Jan 2020 20:19:03 +0000 (12:19 -0800)
committerJonas Devlieghere <jonas@devlieghere.com>
Fri, 31 Jan 2020 20:19:29 +0000 (12:19 -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/lang/c/array_types/TestArrayTypes.py
lldb/packages/Python/lldbsuite/test/lang/c/function_types/TestFunctionTypes.py
lldb/packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py
lldb/packages/Python/lldbsuite/test/lang/cpp/char1632_t/TestChar1632T.py
lldb/packages/Python/lldbsuite/test/lang/cpp/stl/TestStdCXXDisassembly.py
lldb/packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py

index cc9ae8edb6e70c39bea71465de103f5c8bbbd40f..84e0aa3b25a2c53bcb63aa6838c487eca3d4649b 100644 (file)
@@ -53,12 +53,12 @@ class ArrayTypesTestCase(TestBase):
             startstr='(char *[4])',
             substrs=[
                 '(char *) [0]',
-                '(char *) [1]',
-                '(char *) [2]',
-                '(char *) [3]',
                 'Hello',
+                '(char *) [1]',
                 'Hola',
+                '(char *) [2]',
                 'Bonjour',
+                '(char *) [3]',
                 'Guten Tag'])
 
         self.expect(
index 3753eab64ef0135a3acfc7da6cbfffe419d5b81d..a8e4c3dcb4ef61289a6f705b7222a86b230a2f1d 100644 (file)
@@ -38,9 +38,13 @@ class FunctionTypesTestCase(TestBase):
         self.runCmd("continue")
 
         # Check that we do indeed stop on the string_not_empty function.
-        self.expect("process status", STOPPED_DUE_TO_BREAKPOINT,
-                    substrs=['a.out`string_not_empty',
-                             'stop reason = breakpoint'])
+        self.expect(
+            "process status",
+            STOPPED_DUE_TO_BREAKPOINT,
+            substrs=[
+                'stop reason = breakpoint',
+                'a.out`string_not_empty',
+            ])
 
     @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
     @expectedFailureNetBSD
index 690d1abb3cf7cfe0988d98604beb63787a19cab0..a471058b3b45dd8a6e0ee73d4dd31b3e6a72f79c 100644 (file)
@@ -80,15 +80,16 @@ class GlobalVariablesTestCase(TestBase):
             "frame variable --show-types --scope --show-globals --no-args",
             VARIABLES_DISPLAYED_CORRECTLY,
             substrs=[
-                'STATIC: (const int) g_file_static_int = 2',
                 'STATIC: (const char *) g_func_static_cstr',
-                'GLOBAL: (const char *) g_file_global_cstr',
-                '"g_file_global_cstr"',
-                'GLOBAL: (int) g_file_global_int = 42',
-                'GLOBAL: (int) g_common_1 = 21',
+                '"g_func_static_cstr"',
                 'GLOBAL: (int *) g_ptr',
+                'STATIC: (const int) g_file_static_int = 2',
+                'GLOBAL: (int) g_common_1 = 21',
+                'GLOBAL: (int) g_file_global_int = 42',
                 'STATIC: (const char *) g_file_static_cstr',
-                '"g_file_static_cstr"'
+                '"g_file_static_cstr"',
+                'GLOBAL: (const char *) g_file_global_cstr',
+                '"g_file_global_cstr"',
             ])
 
         # 'frame variable' should support address-of operator.
index 7a6d07721d453e44f31236b185054c418420c8ea..a32248f08e597ebdaf308788236e56118af4a4e2 100644 (file)
@@ -55,8 +55,8 @@ class Char1632TestCase(TestBase):
             "frame variable cs16 cs32",
             substrs=[
                 '(const char16_t *) cs16 = ',
-                '(const char32_t *) cs32 = ',
                 'u"hello world ྒྙྐ"',
+                '(const char32_t *) cs32 = ',
                 'U"hello world ྒྙྐ"'])
 
         # Check that we correctly report the non-const types
@@ -64,8 +64,8 @@ class Char1632TestCase(TestBase):
             "frame variable s16 s32",
             substrs=[
                 '(char16_t *) s16 = ',
-                '(char32_t *) s32 = ',
                 'u"ﺸﺵۻ"',
+                '(char32_t *) s32 = ',
                 'U"ЕЙРГЖО"'])
 
         # Check that we correctly report the array types
@@ -92,8 +92,8 @@ class Char1632TestCase(TestBase):
             "frame variable s16 s32",
             substrs=[
                 '(char16_t *) s16 = 0x',
-                '(char32_t *) s32 = ',
                 '"色ハ匂ヘト散リヌルヲ"',
+                '(char32_t *) s32 = ',
                 '"෴"'])
 
         # check the same as above for arrays
index 49aa16ce1060da184f34baeba1ad7eac9cd85dbc..8e719f5371e3e868ce2758d5319e1732eb06211e 100644 (file)
@@ -45,9 +45,14 @@ class StdCXXDisassembleTestCase(TestBase):
         process = target.GetProcess()
 
         # The process should be in a 'stopped' state.
-        self.expect(str(process), STOPPED_DUE_TO_BREAKPOINT, exe=False,
-                    substrs=["a.out",
-                             "stopped"])
+        self.expect(
+            str(process),
+            STOPPED_DUE_TO_BREAKPOINT,
+            exe=False,
+            substrs=[
+                "stopped",
+                "a.out",
+            ])
 
         # Disassemble the functions on the call stack.
         self.runCmd("thread backtrace")
index 632ef7bfe73157e6b68de47fe3fa0199f2d9f607..ea4683051a4bac5f07ab13c8f6bde7c6c1896e82 100644 (file)
@@ -37,9 +37,13 @@ class MethodReturningBOOLTestCase(TestBase):
             self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
 
         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"])
+        self.expect(
+            "process status",
+            STOPPED_DUE_TO_BREAKPOINT,
+            substrs=[
+                "stop reason = breakpoint",
+                " at %s:%d" % (self.main_source, self.line),
+            ])
 
         # rdar://problem/9691614
         self.runCmd('p (int)[my isValid]')