From f5a71b49be7bb22939ec0e225922fe78d8901fc8 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Fri, 31 Jan 2020 12:19:03 -0800 Subject: [PATCH] [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. --- .../test/lang/c/array_types/TestArrayTypes.py | 6 +++--- .../test/lang/c/function_types/TestFunctionTypes.py | 10 +++++++--- .../lang/c/global_variables/TestGlobalVariables.py | 13 +++++++------ .../test/lang/cpp/char1632_t/TestChar1632T.py | 6 +++--- .../test/lang/cpp/stl/TestStdCXXDisassembly.py | 11 ++++++++--- .../radar-9691614/TestObjCMethodReturningBOOL.py | 10 +++++++--- 6 files changed, 35 insertions(+), 21 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py b/lldb/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py index cc9ae8edb6e7..84e0aa3b25a2 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py +++ b/lldb/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py @@ -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( diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/function_types/TestFunctionTypes.py b/lldb/packages/Python/lldbsuite/test/lang/c/function_types/TestFunctionTypes.py index 3753eab64ef0..a8e4c3dcb4ef 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/c/function_types/TestFunctionTypes.py +++ b/lldb/packages/Python/lldbsuite/test/lang/c/function_types/TestFunctionTypes.py @@ -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 diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py b/lldb/packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py index 690d1abb3cf7..a471058b3b45 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py +++ b/lldb/packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py @@ -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', + '"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"', 'GLOBAL: (const char *) g_file_global_cstr', '"g_file_global_cstr"', - 'GLOBAL: (int) g_file_global_int = 42', - 'GLOBAL: (int) g_common_1 = 21', - 'GLOBAL: (int *) g_ptr', - 'STATIC: (const char *) g_file_static_cstr', - '"g_file_static_cstr"' ]) # 'frame variable' should support address-of operator. diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/char1632_t/TestChar1632T.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/char1632_t/TestChar1632T.py index 7a6d07721d45..a32248f08e59 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/cpp/char1632_t/TestChar1632T.py +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/char1632_t/TestChar1632T.py @@ -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 diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/stl/TestStdCXXDisassembly.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/stl/TestStdCXXDisassembly.py index 49aa16ce1060..8e719f5371e3 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/cpp/stl/TestStdCXXDisassembly.py +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/stl/TestStdCXXDisassembly.py @@ -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") diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py b/lldb/packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py index 632ef7bfe731..ea4683051a4b 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py +++ b/lldb/packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py @@ -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]')