Author: Jonas Devlieghere Date: 2023-06-16T14:51:14-07:00 New Revision: ab855530f797bbc113f75f833a4ca5711749d7c8
URL: https://github.com/llvm/llvm-project/commit/ab855530f797bbc113f75f833a4ca5711749d7c8 DIFF: https://github.com/llvm/llvm-project/commit/ab855530f797bbc113f75f833a4ca5711749d7c8.diff LOG: [lldb] Fix Python test formatting (NFC) All Python files in the LLVM repository were reformatted with Black [1]. Files inside the LLDB subproject were reformatted in 2238dcc39358. This patch updates a handful of tests that were added or modified since then and weren't formatted with Black. [1] https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style/68257 Added: Modified: lldb/test/API/commands/dwim-print/TestDWIMPrint.py lldb/test/API/functionalities/inline-stepping/TestInlineStepping.py lldb/test/API/functionalities/step-avoids-no-debug/TestStepNoDebug.py lldb/test/API/functionalities/var_path/TestVarPath.py lldb/test/API/lang/cpp/class_static/TestStaticVariables.py lldb/test/API/lang/cpp/frame-var-depth-and-elem-count/TestFrameVarDepthAndElemCount.py lldb/test/API/python_api/function_symbol/TestDisasmAPI.py lldb/test/API/python_api/function_symbol/TestSymbolAPI.py lldb/test/API/python_api/target/TestTargetAPI.py Removed: ################################################################################ diff --git a/lldb/test/API/commands/dwim-print/TestDWIMPrint.py b/lldb/test/API/commands/dwim-print/TestDWIMPrint.py index 9cb99a2a817d6..040632096c70e 100644 --- a/lldb/test/API/commands/dwim-print/TestDWIMPrint.py +++ b/lldb/test/API/commands/dwim-print/TestDWIMPrint.py @@ -142,5 +142,7 @@ def test_summary_strings(self): def test_void_result(self): """Test dwim-print does not surface an error message for void expressions.""" self.build() - lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.c")) + lldbutil.run_to_source_breakpoint( + self, "// break here", lldb.SBFileSpec("main.c") + ) self.expect("dwim-print (void)15", matching=False, patterns=["(?i)error"]) diff --git a/lldb/test/API/functionalities/inline-stepping/TestInlineStepping.py b/lldb/test/API/functionalities/inline-stepping/TestInlineStepping.py index 49a72c2863e74..752c3a9cbd286 100644 --- a/lldb/test/API/functionalities/inline-stepping/TestInlineStepping.py +++ b/lldb/test/API/functionalities/inline-stepping/TestInlineStepping.py @@ -25,7 +25,7 @@ def test_step_over_with_python_api(self): self.build() self.inline_stepping_step_over() - @add_test_categories(['pyapi']) + @add_test_categories(["pyapi"]) @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr32343") def test_step_in_template_with_python_api(self): """Test stepping in to templated functions.""" diff --git a/lldb/test/API/functionalities/step-avoids-no-debug/TestStepNoDebug.py b/lldb/test/API/functionalities/step-avoids-no-debug/TestStepNoDebug.py index 6c399b8a0a1b2..ad59c5ccb1a4f 100644 --- a/lldb/test/API/functionalities/step-avoids-no-debug/TestStepNoDebug.py +++ b/lldb/test/API/functionalities/step-avoids-no-debug/TestStepNoDebug.py @@ -10,9 +10,10 @@ class StepAvoidsNoDebugTestCase(TestBase): - - @add_test_categories(['pyapi']) - @expectedFailureAll(archs=["aarch64"], oslist=["windows"], bugnumber="llvm.org/pr56292") + @add_test_categories(["pyapi"]) + @expectedFailureAll( + archs=["aarch64"], oslist=["windows"], bugnumber="llvm.org/pr56292" + ) def test_step_out_with_python(self): """Test stepping out using avoid-no-debug with dsyms.""" self.build() @@ -26,8 +27,11 @@ def test_step_out_with_python(self): compiler_version=[">=", "3.9"], archs=["i386"], oslist=no_match(["freebsd"]), - bugnumber="llvm.org/pr28549") - @expectedFailureAll(archs=["aarch64"], oslist=["windows"], bugnumber="llvm.org/pr56292") + bugnumber="llvm.org/pr28549", + ) + @expectedFailureAll( + archs=["aarch64"], oslist=["windows"], bugnumber="llvm.org/pr56292" + ) def test_step_over_with_python(self): """Test stepping over using avoid-no-debug with dwarf.""" self.build() @@ -41,8 +45,11 @@ def test_step_over_with_python(self): compiler_version=[">=", "3.9"], archs=["i386"], oslist=no_match(["freebsd"]), - bugnumber="llvm.org/pr28549") - @expectedFailureAll(archs=["aarch64"], oslist=["windows"], bugnumber="llvm.org/pr56292") + bugnumber="llvm.org/pr28549", + ) + @expectedFailureAll( + archs=["aarch64"], oslist=["windows"], bugnumber="llvm.org/pr56292" + ) def test_step_in_with_python(self): """Test stepping in using avoid-no-debug with dwarf.""" self.build() diff --git a/lldb/test/API/functionalities/var_path/TestVarPath.py b/lldb/test/API/functionalities/var_path/TestVarPath.py index f79b2a7584ae9..73c4f65f8e2e9 100644 --- a/lldb/test/API/functionalities/var_path/TestVarPath.py +++ b/lldb/test/API/functionalities/var_path/TestVarPath.py @@ -118,5 +118,6 @@ def do_test(self): # in type with synthetic children. This used to cause a crash. if not self.isAArch64Windows(): v = frame.GetValueForVariablePath("pt_sp->not_valid_child") - self.assertTrue(v.GetError().Fail(), - "Make sure we don't find 'pt_sp->not_valid_child'") + self.assertTrue( + v.GetError().Fail(), "Make sure we don't find 'pt_sp->not_valid_child'" + ) diff --git a/lldb/test/API/lang/cpp/class_static/TestStaticVariables.py b/lldb/test/API/lang/cpp/class_static/TestStaticVariables.py index c7e38feeb13c3..8211d532b2638 100644 --- a/lldb/test/API/lang/cpp/class_static/TestStaticVariables.py +++ b/lldb/test/API/lang/cpp/class_static/TestStaticVariables.py @@ -107,16 +107,23 @@ def test_with_run_command_complete(self): ) def build_value_check(self, var_name, values): - children_1 = [ValueCheck(name = "x", value = values[0], type = "int"), - ValueCheck(name = "y", value = values[1], type = "int")] - children_2 = [ValueCheck(name = "x", value = values[2], type = "int"), - ValueCheck(name = "y", value = values[3], type = "int")] - elem_0 = ValueCheck(name = "[0]", value=None, type = "PointType", - children=children_1) - elem_1 = ValueCheck(name = "[1]", value=None, type = "PointType", - children=children_2) - value_check = ValueCheck(name=var_name, value = None, type = "PointType[2]", - children = [elem_0, elem_1]) + children_1 = [ + ValueCheck(name="x", value=values[0], type="int"), + ValueCheck(name="y", value=values[1], type="int"), + ] + children_2 = [ + ValueCheck(name="x", value=values[2], type="int"), + ValueCheck(name="y", value=values[3], type="int"), + ] + elem_0 = ValueCheck( + name="[0]", value=None, type="PointType", children=children_1 + ) + elem_1 = ValueCheck( + name="[1]", value=None, type="PointType", children=children_2 + ) + value_check = ValueCheck( + name=var_name, value=None, type="PointType[2]", children=[elem_0, elem_1] + ) return value_check @@ -161,7 +168,7 @@ def test_with_python_FindValue(self): value_check_none = self.build_value_check("g_points", ["3", "4", "33", "44"]) value_check_AA = self.build_value_check("AA::g_points", ["5", "6", "55", "66"]) - for val in valList: + for val in valList: self.DebugSBValue(val) name = val.GetName() self.assertIn(name, ["g_points", "A::g_points", "AA::g_points"]) @@ -252,17 +259,18 @@ def test_with_python_FindGlobalVariables(self): elif name == "AA::g_points": value_check_AA.check_value(self, val, "A found by regex") found_aa = True - + self.assertTrue(found_a, "Regex search found A::g_points") self.assertTrue(found_aa, "Regex search found AA::g_points") # Normal search for full name should find one, but it looks like we don't match # on identifier boundaries here yet: val_list = target.FindGlobalVariables("A::g_points", 10, lldb.eMatchTypeNormal) - self.assertEqual(val_list.GetSize(), 2, "We aren't matching on name boundaries yet") + self.assertEqual( + val_list.GetSize(), 2, "We aren't matching on name boundaries yet" + ) # Normal search for g_points should find 3 - FindGlobalVariables doesn't distinguish # between file statics and globals: val_list = target.FindGlobalVariables("g_points", 10, lldb.eMatchTypeNormal) self.assertEqual(val_list.GetSize(), 3, "Found all three g_points") - diff --git a/lldb/test/API/lang/cpp/frame-var-depth-and-elem-count/TestFrameVarDepthAndElemCount.py b/lldb/test/API/lang/cpp/frame-var-depth-and-elem-count/TestFrameVarDepthAndElemCount.py index 49a56c4d6ab89..1dfd7df9ff1be 100644 --- a/lldb/test/API/lang/cpp/frame-var-depth-and-elem-count/TestFrameVarDepthAndElemCount.py +++ b/lldb/test/API/lang/cpp/frame-var-depth-and-elem-count/TestFrameVarDepthAndElemCount.py @@ -16,12 +16,13 @@ def test(self): ) # Check that we print 5 elements but only 2 levels deep. - self.expect('frame var --depth 2 --element-count 5 -- c', - substrs=[ - '[0] = {\n b ={...}\n }', - '[1] = {\n b ={...}\n }', - '[2] = {\n b ={...}\n }', - '[3] = {\n b ={...}\n }', - '[4] = {\n b ={...}\n }', - ]) - + self.expect( + "frame var --depth 2 --element-count 5 -- c", + substrs=[ + "[0] = {\n b ={...}\n }", + "[1] = {\n b ={...}\n }", + "[2] = {\n b ={...}\n }", + "[3] = {\n b ={...}\n }", + "[4] = {\n b ={...}\n }", + ], + ) diff --git a/lldb/test/API/python_api/function_symbol/TestDisasmAPI.py b/lldb/test/API/python_api/function_symbol/TestDisasmAPI.py index 572d76e17c768..bd5623da98d98 100644 --- a/lldb/test/API/python_api/function_symbol/TestDisasmAPI.py +++ b/lldb/test/API/python_api/function_symbol/TestDisasmAPI.py @@ -20,7 +20,7 @@ def setUp(self): "main.c", "// Find the line number for breakpoint 2 here." ) - @expectedFailureAll(oslist=["windows"], bugnumber='llvm.org/pr21765') + @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765") def test(self): """Exercise getting SBAddress objects, disassembly, and SBAddress APIs.""" self.build() diff --git a/lldb/test/API/python_api/function_symbol/TestSymbolAPI.py b/lldb/test/API/python_api/function_symbol/TestSymbolAPI.py index 04c807bbb76a5..309e3796dbd48 100644 --- a/lldb/test/API/python_api/function_symbol/TestSymbolAPI.py +++ b/lldb/test/API/python_api/function_symbol/TestSymbolAPI.py @@ -20,7 +20,7 @@ def setUp(self): "main.c", "// Find the line number for breakpoint 2 here." ) - @expectedFailureAll(oslist=["windows"], bugnumber='llvm.org/pr21765') + @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765") def test(self): """Exercise some SBSymbol and SBAddress APIs.""" self.build() diff --git a/lldb/test/API/python_api/target/TestTargetAPI.py b/lldb/test/API/python_api/target/TestTargetAPI.py index c9e7e80a400b6..c8e1904428c8a 100644 --- a/lldb/test/API/python_api/target/TestTargetAPI.py +++ b/lldb/test/API/python_api/target/TestTargetAPI.py @@ -55,7 +55,7 @@ def test_get_description(self): self.build() self.get_description() - @expectedFailureAll(oslist=["windows"], bugnumber='llvm.org/pr21765') + @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765") def test_resolve_symbol_context_with_address(self): """Exercise SBTarget.ResolveSymbolContextForAddress() API.""" self.build() _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits