[Lldb-commits] [lldb] 096c530 - [lldb] Fix Python test formatting (NFC)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 15 22:54:13 PST 2024


Author: Jonas Devlieghere
Date: 2024-02-15T22:54:00-08:00
New Revision: 096c530ab3ea5c96526451181117f30db17b4b1d

URL: https://github.com/llvm/llvm-project/commit/096c530ab3ea5c96526451181117f30db17b4b1d
DIFF: https://github.com/llvm/llvm-project/commit/096c530ab3ea5c96526451181117f30db17b4b1d.diff

LOG: [lldb] Fix Python test formatting (NFC)

Added: 
    

Modified: 
    lldb/test/API/commands/command/script/add/TestAddParsedCommand.py
    lldb/test/API/commands/command/script/add/test_commands.py
    lldb/test/API/commands/expression/nested/TestNestedExpressions.py
    lldb/test/API/commands/process/attach/TestProcessAttach.py
    lldb/test/API/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
    lldb/test/API/functionalities/executable_first/TestExecutableFirst.py
    lldb/test/API/functionalities/inline-sourcefile/TestInlineSourceFiles.py
    lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
    lldb/test/API/functionalities/type_find_first/TestFindFirstType.py
    lldb/test/API/functionalities/vtable/TestVTableValue.py
    lldb/test/API/lang/cpp/union-static-data-members/TestCppUnionStaticMembers.py
    lldb/test/API/lang/cpp/unique-types4/TestUniqueTypes4.py
    lldb/test/API/lang/objc/charstar_dyntype/TestCharStarDynType.py
    lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
    lldb/test/API/python_api/process/cancel_attach/TestCancelAttach.py
    lldb/test/API/python_api/value/TestValueAPI.py
    lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_logpoints.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/commands/command/script/add/TestAddParsedCommand.py b/lldb/test/API/commands/command/script/add/TestAddParsedCommand.py
index 7dba9c6937f211..d30b0b67124ed2 100644
--- a/lldb/test/API/commands/command/script/add/TestAddParsedCommand.py
+++ b/lldb/test/API/commands/command/script/add/TestAddParsedCommand.py
@@ -16,7 +16,7 @@ class ParsedCommandTestCase(TestBase):
     def test(self):
         self.pycmd_tests()
 
-    def check_help_options(self, cmd_name, opt_list, substrs = []):
+    def check_help_options(self, cmd_name, opt_list, substrs=[]):
         """
         Pass the command name in cmd_name and a vector of the short option, type & long option.
         This will append the checks for all the options and test "help command".
@@ -30,78 +30,108 @@ def check_help_options(self, cmd_name, opt_list, substrs = []):
                 (short_opt, type, long_opt) = elem
                 substrs.append(f"-{short_opt} <{type}> ( --{long_opt} <{type}> )")
         print(f"Opt Vec\n{substrs}")
-        self.expect("help " + cmd_name, substrs = substrs)
+        self.expect("help " + cmd_name, substrs=substrs)
 
     def pycmd_tests(self):
         source_dir = self.getSourceDir()
         test_file_path = os.path.join(source_dir, "test_commands.py")
         self.runCmd("command script import " + test_file_path)
-        self.expect("help", substrs = ["no-args", "one-arg-no-opt", "two-args"])
+        self.expect("help", substrs=["no-args", "one-arg-no-opt", "two-args"])
 
         # Test that we did indeed add these commands as user commands:
 
         # This is the function to remove the custom commands in order to have a
         # clean slate for the next test case.
         def cleanup():
-            self.runCmd("command script delete no-args one-arg-no-opt two-args", check=False)
+            self.runCmd(
+                "command script delete no-args one-arg-no-opt two-args", check=False
+            )
 
         # Execute the cleanup function during test case tear down.
         self.addTearDownHook(cleanup)
 
         # First test the no arguments command.  Make sure the help is right:
-        no_arg_opts = [["b", "boolean", "bool-arg"],
-                       "+a boolean arg, defaults to True",
-                       ["d", "filename", "disk-file-name"],
-                       "+An on disk filename",
-                       ["e", "none", "enum-option"],
-                       "+An enum, doesn't actually do anything",
-                       "+Values: foo | bar | baz",
-                       ["l", "linenum", "line-num"],
-                       "+A line number",
-                       ["s", "shlib-name", "shlib-name"],
-                       "+A shared library name"]
-        substrs = ["Example command for use in debugging",
-                   "Syntax: no-args <cmd-options>"]
-        
+        no_arg_opts = [
+            ["b", "boolean", "bool-arg"],
+            "+a boolean arg, defaults to True",
+            ["d", "filename", "disk-file-name"],
+            "+An on disk filename",
+            ["e", "none", "enum-option"],
+            "+An enum, doesn't actually do anything",
+            "+Values: foo | bar | baz",
+            ["l", "linenum", "line-num"],
+            "+A line number",
+            ["s", "shlib-name", "shlib-name"],
+            "+A shared library name",
+        ]
+        substrs = [
+            "Example command for use in debugging",
+            "Syntax: no-args <cmd-options>",
+        ]
+
         self.check_help_options("no-args", no_arg_opts, substrs)
 
         # Make sure the command doesn't accept arguments:
-        self.expect("no-args an-arg", substrs=["'no-args' doesn't take any arguments."],
-                    error=True)
+        self.expect(
+            "no-args an-arg",
+            substrs=["'no-args' doesn't take any arguments."],
+            error=True,
+        )
 
         # Try setting the bool with the wrong value:
-        self.expect("no-args -b Something",
-                    substrs=["Error setting option: bool-arg to Something"],
-                    error=True)
+        self.expect(
+            "no-args -b Something",
+            substrs=["Error setting option: bool-arg to Something"],
+            error=True,
+        )
         # Try setting the enum to an illegal value as well:
-        self.expect("no-args --enum-option Something",
-                    substrs=["error: Error setting option: enum-option to Something"],
-                    error=True)
-        
+        self.expect(
+            "no-args --enum-option Something",
+            substrs=["error: Error setting option: enum-option to Something"],
+            error=True,
+        )
+
         # Check some of the command groups:
-        self.expect("no-args -b true -s Something -l 10",
-                    substrs=["error: invalid combination of options for the given command"],
-                    error=True)
-                    
+        self.expect(
+            "no-args -b true -s Something -l 10",
+            substrs=["error: invalid combination of options for the given command"],
+            error=True,
+        )
+
         # Now set the bool arg correctly, note only the first option was set:
-        self.expect("no-args -b true", substrs=["bool-arg (set: True): True",
-                                                "shlib-name (set: False):",
-                                                "disk-file-name (set: False):",
-                                                "line-num (set: False):",
-                                                "enum-option (set: False):"])
+        self.expect(
+            "no-args -b true",
+            substrs=[
+                "bool-arg (set: True): True",
+                "shlib-name (set: False):",
+                "disk-file-name (set: False):",
+                "line-num (set: False):",
+                "enum-option (set: False):",
+            ],
+        )
 
         # Now set the enum arg correctly, note only the first option was set:
-        self.expect("no-args -e foo", substrs=["bool-arg (set: False):",
-                                                "shlib-name (set: False):",
-                                                "disk-file-name (set: False):",
-                                                "line-num (set: False):",
-                                                "enum-option (set: True): foo"])
+        self.expect(
+            "no-args -e foo",
+            substrs=[
+                "bool-arg (set: False):",
+                "shlib-name (set: False):",
+                "disk-file-name (set: False):",
+                "line-num (set: False):",
+                "enum-option (set: True): foo",
+            ],
+        )
         # Try a pair together:
-        self.expect("no-args -b false -s Something", substrs=["bool-arg (set: True): False",
-                                                "shlib-name (set: True): Something",
-                                                "disk-file-name (set: False):",
-                                                "line-num (set: False):",
-                                                "enum-option (set: False):"])
+        self.expect(
+            "no-args -b false -s Something",
+            substrs=[
+                "bool-arg (set: True): False",
+                "shlib-name (set: True): Something",
+                "disk-file-name (set: False):",
+                "line-num (set: False):",
+                "enum-option (set: False):",
+            ],
+        )
 
         # Next try some completion tests:
 
@@ -109,16 +139,25 @@ def cleanup():
         matches = lldb.SBStringList()
         descriptions = lldb.SBStringList()
 
-        # First try an enum completion: 
-        num_completions = interp.HandleCompletionWithDescriptions("no-args -e f", 12, 0,
-                                                                  1000, matches, descriptions)
+        # First try an enum completion:
+        num_completions = interp.HandleCompletionWithDescriptions(
+            "no-args -e f", 12, 0, 1000, matches, descriptions
+        )
         self.assertEqual(num_completions, 1, "Only one completion for foo")
-        self.assertEqual(matches.GetSize(), 2, "The first element is the complete additional text")
-        self.assertEqual(matches.GetStringAtIndex(0), "oo ", "And we got the right extra characters")
-        self.assertEqual(matches.GetStringAtIndex(1), "foo", "And we got the right match")
-        self.assertEqual(descriptions.GetSize(), 2, "descriptions matche the return length")
+        self.assertEqual(
+            matches.GetSize(), 2, "The first element is the complete additional text"
+        )
+        self.assertEqual(
+            matches.GetStringAtIndex(0), "oo ", "And we got the right extra characters"
+        )
+        self.assertEqual(
+            matches.GetStringAtIndex(1), "foo", "And we got the right match"
+        )
+        self.assertEqual(
+            descriptions.GetSize(), 2, "descriptions matche the return length"
+        )
         # FIXME: we don't return descriptions for enum elements
-        #self.assertEqual(descriptions.GetStringAtIndex(1), "does foo things", "And we got the right description")
+        # self.assertEqual(descriptions.GetStringAtIndex(1), "does foo things", "And we got the right description")
 
         # Now try an internal completer, the on disk file one is handy:
         partial_name = os.path.join(source_dir, "test_")
@@ -126,21 +165,35 @@ def cleanup():
 
         matches.Clear()
         descriptions.Clear()
-        num_completions = interp.HandleCompletionWithDescriptions(cmd_str, len(cmd_str) - 1, 0,
-                                                                  1000, matches, descriptions)
-        print(f"First: {matches.GetStringAtIndex(0)}\nSecond: {matches.GetStringAtIndex(1)}\nThird: {matches.GetStringAtIndex(2)}")
+        num_completions = interp.HandleCompletionWithDescriptions(
+            cmd_str, len(cmd_str) - 1, 0, 1000, matches, descriptions
+        )
+        print(
+            f"First: {matches.GetStringAtIndex(0)}\nSecond: {matches.GetStringAtIndex(1)}\nThird: {matches.GetStringAtIndex(2)}"
+        )
         self.assertEqual(num_completions, 1, "Only one completion for source file")
         self.assertEqual(matches.GetSize(), 2, "The first element is the complete line")
-        self.assertEqual(matches.GetStringAtIndex(0), "commands.py' ", "And we got the right extra characters")
-        self.assertEqual(matches.GetStringAtIndex(1), test_file_path, "And we got the right match")
-        self.assertEqual(descriptions.GetSize(), 2, "descriptions match the return length")
+        self.assertEqual(
+            matches.GetStringAtIndex(0),
+            "commands.py' ",
+            "And we got the right extra characters",
+        )
+        self.assertEqual(
+            matches.GetStringAtIndex(1), test_file_path, "And we got the right match"
+        )
+        self.assertEqual(
+            descriptions.GetSize(), 2, "descriptions match the return length"
+        )
         # FIXME: we don't return descriptions for enum elements
-        #self.assertEqual(descriptions.GetStringAtIndex(1), "does foo things", "And we got the right description")
-        
+        # self.assertEqual(descriptions.GetStringAtIndex(1), "does foo things", "And we got the right description")
+
         # Try a command with arguments.
         # FIXME: It should be enough to define an argument and it's type to get the completer
         # wired up for that argument type if it is a known type. But that isn't wired up in the
         # command parser yet, so I don't have any tests for that.  We also don't currently check
         # that the arguments passed match the argument specifications, so here I just pass a couple
         # sets of arguments and make sure we get back what we put in:
-        self.expect("two-args 'First Argument' 'Second Argument'", substrs=["0: First Argument", "1: Second Argument"])
+        self.expect(
+            "two-args 'First Argument' 'Second Argument'",
+            substrs=["0: First Argument", "1: Second Argument"],
+        )

diff  --git a/lldb/test/API/commands/command/script/add/test_commands.py b/lldb/test/API/commands/command/script/add/test_commands.py
index 801d58814ac373..68f5a445563666 100644
--- a/lldb/test/API/commands/command/script/add/test_commands.py
+++ b/lldb/test/API/commands/command/script/add/test_commands.py
@@ -6,6 +6,7 @@
 import lldb
 from lldb.plugins.parsed_cmd import ParsedCommand
 
+
 class ReportingCmd(ParsedCommand):
     def __init__(self, debugger, unused):
         super().__init__(debugger, unused)
@@ -16,16 +17,21 @@ def __call__(self, debugger, args_array, exe_ctx, result):
             result.AppendMessage("Options:\n")
             for long_option, elem in opt_def.items():
                 dest = elem["dest"]
-                result.AppendMessage(f"{long_option} (set: {elem['_value_set']}): {object.__getattribute__(self.ov_parser, dest)}\n")
+                result.AppendMessage(
+                    f"{long_option} (set: {elem['_value_set']}): {object.__getattribute__(self.ov_parser, dest)}\n"
+                )
         else:
             result.AppendMessage("No options\n")
 
         num_args = args_array.GetSize()
         if num_args > 0:
             result.AppendMessage(f"{num_args} arguments:")
-        for idx in range(0,num_args):
-          result.AppendMessage(f"{idx}: {args_array.GetItemAtIndex(idx).GetStringValue(10000)}\n")
-    
+        for idx in range(0, num_args):
+            result.AppendMessage(
+                f"{idx}: {args_array.GetItemAtIndex(idx).GetStringValue(10000)}\n"
+            )
+
+
 class NoArgsCommand(ReportingCmd):
     program = "no-args"
 
@@ -41,10 +47,10 @@ def setup_command_definition(self):
             "b",
             "bool-arg",
             "a boolean arg, defaults to True",
-            value_type = lldb.eArgTypeBoolean,
-            groups = [1,2],
-            dest = "bool_arg",
-            default = True
+            value_type=lldb.eArgTypeBoolean,
+            groups=[1, 2],
+            dest="bool_arg",
+            default=True,
         )
 
         self.ov_parser.add_option(
@@ -52,48 +58,51 @@ def setup_command_definition(self):
             "shlib-name",
             "A shared library name.",
             value_type=lldb.eArgTypeShlibName,
-            groups = [1, [3,4]],
-            dest = "shlib_name",
-            default = None
+            groups=[1, [3, 4]],
+            dest="shlib_name",
+            default=None,
         )
 
         self.ov_parser.add_option(
             "d",
             "disk-file-name",
             "An on disk filename",
-            value_type = lldb.eArgTypeFilename,
-            dest = "disk_file_name",
-            default = None
+            value_type=lldb.eArgTypeFilename,
+            dest="disk_file_name",
+            default=None,
         )
 
         self.ov_parser.add_option(
             "l",
             "line-num",
             "A line number",
-            value_type = lldb.eArgTypeLineNum,
-            groups = 3,
-            dest = "line_num",
-            default = 0
+            value_type=lldb.eArgTypeLineNum,
+            groups=3,
+            dest="line_num",
+            default=0,
         )
-        
+
         self.ov_parser.add_option(
             "e",
             "enum-option",
             "An enum, doesn't actually do anything",
-            enum_values = [["foo", "does foo things"],
-                           ["bar", "does bar things"],
-                           ["baz", "does baz things"]],
-            groups = 4,
-            dest = "enum_option",
-            default = "foo"
+            enum_values=[
+                ["foo", "does foo things"],
+                ["bar", "does bar things"],
+                ["baz", "does baz things"],
+            ],
+            groups=4,
+            dest="enum_option",
+            default="foo",
         )
-        
+
     def get_short_help(self):
         return "Example command for use in debugging"
 
     def get_long_help(self):
         return self.help_string
 
+
 class OneArgCommandNoOptions(ReportingCmd):
     program = "one-arg-no-opt"
 
@@ -105,14 +114,17 @@ def register_lldb_command(cls, debugger, module_name):
         ParsedCommand.do_register_cmd(cls, debugger, module_name)
 
     def setup_command_definition(self):
-        self.ov_parser.add_argument_set([self.ov_parser.make_argument_element(lldb.eArgTypeSourceFile, "plain")])
-        
+        self.ov_parser.add_argument_set(
+            [self.ov_parser.make_argument_element(lldb.eArgTypeSourceFile, "plain")]
+        )
+
     def get_short_help(self):
         return "Example command for use in debugging"
 
     def get_long_help(self):
         return self.help_string
 
+
 class TwoArgGroupsCommand(ReportingCmd):
     program = "two-args"
 
@@ -128,10 +140,10 @@ def setup_command_definition(self):
             "l",
             "language",
             "language defaults to None",
-            value_type = lldb.eArgTypeLanguage,
-            groups = [1,2],
-            dest = "language",
-            default = None
+            value_type=lldb.eArgTypeLanguage,
+            groups=[1, 2],
+            dest="language",
+            default=None,
         )
 
         self.ov_parser.add_option(
@@ -139,32 +151,49 @@ def setup_command_definition(self):
             "log-channel",
             "log channel - defaults to lldb",
             value_type=lldb.eArgTypeLogChannel,
-            groups = [1, 3],
-            dest = "log_channel",
-            default = "lldb"
+            groups=[1, 3],
+            dest="log_channel",
+            default="lldb",
         )
 
         self.ov_parser.add_option(
             "p",
             "process-name",
             "A process name, defaults to None",
-            value_type = lldb.eArgTypeProcessName,
-            dest = "proc_name",
-            default = None
+            value_type=lldb.eArgTypeProcessName,
+            dest="proc_name",
+            default=None,
+        )
+
+        self.ov_parser.add_argument_set(
+            [
+                self.ov_parser.make_argument_element(
+                    lldb.eArgTypeClassName, "plain", [1, 2]
+                ),
+                self.ov_parser.make_argument_element(
+                    lldb.eArgTypeOffset, "optional", [1, 2]
+                ),
+            ]
         )
 
-        self.ov_parser.add_argument_set([self.ov_parser.make_argument_element(lldb.eArgTypeClassName, "plain", [1,2]),
-                         self.ov_parser.make_argument_element(lldb.eArgTypeOffset, "optional", [1,2])])
+        self.ov_parser.add_argument_set(
+            [
+                self.ov_parser.make_argument_element(
+                    lldb.eArgTypePythonClass, "plain", [3, 4]
+                ),
+                self.ov_parser.make_argument_element(
+                    lldb.eArgTypePid, "optional", [3, 4]
+                ),
+            ]
+        )
 
-        self.ov_parser.add_argument_set([self.ov_parser.make_argument_element(lldb.eArgTypePythonClass, "plain", [3,4]),
-                         self.ov_parser.make_argument_element(lldb.eArgTypePid, "optional", [3,4])])
-        
     def get_short_help(self):
         return "Example command for use in debugging"
 
     def get_long_help(self):
         return self.help_string
 
+
 def __lldb_init_module(debugger, dict):
     # Register all classes that have a register_lldb_command method
     for _name, cls in inspect.getmembers(sys.modules[__name__]):

diff  --git a/lldb/test/API/commands/expression/nested/TestNestedExpressions.py b/lldb/test/API/commands/expression/nested/TestNestedExpressions.py
index 6a97d4f34e6792..0dabe42f4e74c5 100644
--- a/lldb/test/API/commands/expression/nested/TestNestedExpressions.py
+++ b/lldb/test/API/commands/expression/nested/TestNestedExpressions.py
@@ -9,22 +9,23 @@
 
 
 class NestedExpressions(TestBase):
-
     def test_enum_in_nested_structs(self):
         """
-            Test expressions that references an enumeration in nested structs.
+        Test expressions that references an enumeration in nested structs.
         """
         self.build()
         exe_path = self.getBuildArtifact("a.out")
         target = self.dbg.CreateTarget(exe_path)
         self.assertTrue(target, "Target: %s is not valid." % (exe_path))
-        self.expect_expr("A::B::C::EnumType::Eleven",
-                         result_type="A::B::C::EnumType",
-                         result_value="Eleven")
+        self.expect_expr(
+            "A::B::C::EnumType::Eleven",
+            result_type="A::B::C::EnumType",
+            result_value="Eleven",
+        )
 
     def test_struct_in_nested_structs(self):
         """
-            Test expressions that references a struct in nested structs.
+        Test expressions that references a struct in nested structs.
         """
         self.build()
         exe_path = self.getBuildArtifact("a.out")
@@ -37,36 +38,36 @@ def test_struct_in_nested_structs(self):
     @skipIfWindows
     def test_static_in_nested_structs(self):
         """
-            Test expressions that references a static variable in nested structs.
+        Test expressions that references a static variable in nested structs.
         """
         self.build()
         (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
             self, "Stop here to evaluate expressions", lldb.SBFileSpec("main.cpp")
         )
-        self.expect_expr("A::B::C::enum_static",
-                         result_type="A::B::C::EnumType",
-                         result_value="Eleven")
+        self.expect_expr(
+            "A::B::C::enum_static",
+            result_type="A::B::C::EnumType",
+            result_value="Eleven",
+        )
 
     def test_enum_in_nested_namespaces(self):
         """
-            Test expressions that references an enumeration in nested namespaces.
+        Test expressions that references an enumeration in nested namespaces.
         """
         self.build()
         exe_path = self.getBuildArtifact("a.out")
         target = self.dbg.CreateTarget(exe_path)
         self.assertTrue(target, "Target: %s is not valid." % (exe_path))
-        self.expect_expr("a::b::c::Color::Blue",
-                         result_type="a::b::c::Color",
-                         result_value="Blue")
+        self.expect_expr(
+            "a::b::c::Color::Blue", result_type="a::b::c::Color", result_value="Blue"
+        )
 
     def test_static_in_nested_namespaces(self):
         """
-            Test expressions that references an enumeration in nested namespaces.
+        Test expressions that references an enumeration in nested namespaces.
         """
         self.build()
         (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
             self, "Stop here to evaluate expressions", lldb.SBFileSpec("main.cpp")
         )
-        self.expect_expr("a::b::c::d",
-                         result_type="int",
-                         result_value="12")
+        self.expect_expr("a::b::c::d", result_type="int", result_value="12")

diff  --git a/lldb/test/API/commands/process/attach/TestProcessAttach.py b/lldb/test/API/commands/process/attach/TestProcessAttach.py
index 7be36f9644a4fa..0e916d2e8e4cbe 100644
--- a/lldb/test/API/commands/process/attach/TestProcessAttach.py
+++ b/lldb/test/API/commands/process/attach/TestProcessAttach.py
@@ -128,4 +128,3 @@ def tearDown(self):
 
         # Call super's tearDown().
         TestBase.tearDown(self)
-

diff  --git a/lldb/test/API/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py b/lldb/test/API/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
index d296e60d6e6e99..b740689e675380 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
@@ -299,11 +299,11 @@ def cleanup():
         self.runCmd("settings set target.max-string-summary-length 5")
         some_string = self.frame().FindVariable("some_string")
         some_string_summary = some_string.GetSummary()
-        if (re.match(r"^std::__\w+::", some_string.GetTypeName())):
-          self.assertEqual(some_string_summary, '"01234"...')
+        if re.match(r"^std::__\w+::", some_string.GetTypeName()):
+            self.assertEqual(some_string_summary, '"01234"...')
         else:
-          #libstdc++ string formatter suffers from the same problem as some_cstring below
-          pass
+            # libstdc++ string formatter suffers from the same problem as some_cstring below
+            pass
 
         some_carr = self.frame().FindVariable("some_carr")
         some_carr_summary = some_carr.GetSummary()

diff  --git a/lldb/test/API/functionalities/executable_first/TestExecutableFirst.py b/lldb/test/API/functionalities/executable_first/TestExecutableFirst.py
index 4f753239f3dbb8..31ff9b85b4e9f4 100644
--- a/lldb/test/API/functionalities/executable_first/TestExecutableFirst.py
+++ b/lldb/test/API/functionalities/executable_first/TestExecutableFirst.py
@@ -12,7 +12,7 @@ class TestExecutableIsFirst(TestBase):
 
     # ELF does not have a hard distinction between shared libraries and
     # (position-independent) executables
-    @skipIf(oslist=no_match(lldbplatformutil.getDarwinOSTriples()+["windows"]))
+    @skipIf(oslist=no_match(lldbplatformutil.getDarwinOSTriples() + ["windows"]))
     def test_executable_is_first_before_run(self):
         self.build()
 
@@ -44,8 +44,10 @@ def test_executable_is_first_before_run(self):
     def test_executable_is_first_during_run(self):
         self.build()
         (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
-            self, "break after function call", lldb.SBFileSpec("main.cpp"),
-            extra_images=["bar"]
+            self,
+            "break after function call",
+            lldb.SBFileSpec("main.cpp"),
+            extra_images=["bar"],
         )
 
         first_module = target.GetModuleAtIndex(0)

diff  --git a/lldb/test/API/functionalities/inline-sourcefile/TestInlineSourceFiles.py b/lldb/test/API/functionalities/inline-sourcefile/TestInlineSourceFiles.py
index ad10a63e601329..af14f5e7d6a74f 100644
--- a/lldb/test/API/functionalities/inline-sourcefile/TestInlineSourceFiles.py
+++ b/lldb/test/API/functionalities/inline-sourcefile/TestInlineSourceFiles.py
@@ -13,5 +13,5 @@ class InlineSourceFilesTestCase(TestBase):
     def test(self):
         """Test DWARF inline source files."""
         self.build()
-        lldbutil.run_to_name_breakpoint(self, 'f')
+        lldbutil.run_to_name_breakpoint(self, "f")
         self.expect("list f", substrs=["This is inline source code"])

diff  --git a/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py b/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
index 7c04166b85fffe..a0e2afbf477d0f 100644
--- a/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
+++ b/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
@@ -11,9 +11,9 @@
 
 
 class ProcessSaveCoreMinidumpTestCase(TestBase):
-
-    def verify_core_file(self, core_path, expected_pid, expected_modules,
-                         expected_threads):
+    def verify_core_file(
+        self, core_path, expected_pid, expected_modules, expected_threads
+    ):
         # To verify, we'll launch with the mini dump
         target = self.dbg.CreateTarget(None)
         process = target.LoadCore(core_path)
@@ -77,50 +77,47 @@ def test_save_linux_mini_dump(self):
 
             # save core and, kill process and verify corefile existence
             base_command = "process save-core --plugin-name=minidump "
-            self.runCmd(
-                base_command + " --style=stack '%s'" % (core_stack)
-            )
+            self.runCmd(base_command + " --style=stack '%s'" % (core_stack))
             self.assertTrue(os.path.isfile(core_stack))
-            self.verify_core_file(core_stack, expected_pid, expected_modules,
-                                  expected_threads)
-
-            self.runCmd(
-                base_command + " --style=modified-memory '%s'" % (core_dirty)
+            self.verify_core_file(
+                core_stack, expected_pid, expected_modules, expected_threads
             )
-            self.assertTrue(os.path.isfile(core_dirty))
-            self.verify_core_file(core_dirty, expected_pid, expected_modules,
-                                  expected_threads)
 
-            self.runCmd(
-                base_command + " --style=full '%s'" % (core_full)
+            self.runCmd(base_command + " --style=modified-memory '%s'" % (core_dirty))
+            self.assertTrue(os.path.isfile(core_dirty))
+            self.verify_core_file(
+                core_dirty, expected_pid, expected_modules, expected_threads
             )
+
+            self.runCmd(base_command + " --style=full '%s'" % (core_full))
             self.assertTrue(os.path.isfile(core_full))
-            self.verify_core_file(core_full, expected_pid, expected_modules,
-                                  expected_threads)
+            self.verify_core_file(
+                core_full, expected_pid, expected_modules, expected_threads
+            )
 
             # validate saving via SBProcess
-            error = process.SaveCore(core_sb_stack, "minidump",
-                                     lldb.eSaveCoreStackOnly)
+            error = process.SaveCore(core_sb_stack, "minidump", lldb.eSaveCoreStackOnly)
             self.assertTrue(error.Success())
             self.assertTrue(os.path.isfile(core_sb_stack))
-            self.verify_core_file(core_sb_stack, expected_pid,
-                                  expected_modules, expected_threads)
+            self.verify_core_file(
+                core_sb_stack, expected_pid, expected_modules, expected_threads
+            )
 
-            error = process.SaveCore(core_sb_dirty, "minidump",
-                                     lldb.eSaveCoreDirtyOnly)
+            error = process.SaveCore(core_sb_dirty, "minidump", lldb.eSaveCoreDirtyOnly)
             self.assertTrue(error.Success())
             self.assertTrue(os.path.isfile(core_sb_dirty))
-            self.verify_core_file(core_sb_dirty, expected_pid, expected_modules,
-                                  expected_threads)
+            self.verify_core_file(
+                core_sb_dirty, expected_pid, expected_modules, expected_threads
+            )
 
             # Minidump can now save full core files, but they will be huge and
             # they might cause this test to timeout.
-            error = process.SaveCore(core_sb_full, "minidump",
-                                     lldb.eSaveCoreFull)
+            error = process.SaveCore(core_sb_full, "minidump", lldb.eSaveCoreFull)
             self.assertTrue(error.Success())
             self.assertTrue(os.path.isfile(core_sb_full))
-            self.verify_core_file(core_sb_full, expected_pid, expected_modules,
-                                  expected_threads)
+            self.verify_core_file(
+                core_sb_full, expected_pid, expected_modules, expected_threads
+            )
 
             self.assertSuccess(process.Kill())
         finally:

diff  --git a/lldb/test/API/functionalities/type_find_first/TestFindFirstType.py b/lldb/test/API/functionalities/type_find_first/TestFindFirstType.py
index 432708d144f269..6347a35e72ea3f 100644
--- a/lldb/test/API/functionalities/type_find_first/TestFindFirstType.py
+++ b/lldb/test/API/functionalities/type_find_first/TestFindFirstType.py
@@ -8,18 +8,17 @@
 
 
 class TypeFindFirstTestCase(TestBase):
-
     NO_DEBUG_INFO_TESTCASE = True
 
     def test_find_first_type(self):
         """
-            Test SBTarget::FindFirstType() and SBModule::FindFirstType() APIs.
+        Test SBTarget::FindFirstType() and SBModule::FindFirstType() APIs.
 
-            This function had regressed after some past modification of the type
-            lookup internal code where if we had multiple types with the same
-            basename, FindFirstType() could end up failing depending on which
-            type was found first in the debug info indexes. This test will
-            ensure this doesn't regress in the future.
+        This function had regressed after some past modification of the type
+        lookup internal code where if we had multiple types with the same
+        basename, FindFirstType() could end up failing depending on which
+        type was found first in the debug info indexes. This test will
+        ensure this doesn't regress in the future.
         """
         self.build()
         target = self.createTestTarget()

diff  --git a/lldb/test/API/functionalities/vtable/TestVTableValue.py b/lldb/test/API/functionalities/vtable/TestVTableValue.py
index e4db0666dc1b29..3ee571207e7f92 100644
--- a/lldb/test/API/functionalities/vtable/TestVTableValue.py
+++ b/lldb/test/API/functionalities/vtable/TestVTableValue.py
@@ -8,6 +8,7 @@
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 
+
 class TestVTableValue(TestBase):
     # If your test case doesn't stress debug info, then
     # set this to true.  That way it won't be run once for
@@ -36,7 +37,7 @@ def test_vtable(self):
         expected_addr = self.expected_vtable_addr(shape)
         self.assertEquals(vtable_addr, expected_addr)
 
-        for (idx, vtable_entry) in enumerate(vtable.children):
+        for idx, vtable_entry in enumerate(vtable.children):
             self.verify_vtable_entry(vtable_entry, vtable_addr, idx)
 
         # Test a shape reference to make sure we get the vtable correctly.
@@ -53,10 +54,9 @@ def test_vtable(self):
         expected_addr = self.expected_vtable_addr(shape)
         self.assertEquals(vtable_addr, expected_addr)
 
-        for (idx, vtable_entry) in enumerate(vtable.children):
+        for idx, vtable_entry in enumerate(vtable.children):
             self.verify_vtable_entry(vtable_entry, vtable_addr, idx)
 
-
         # Test we get the right vtable for the Rectangle instance.
         rect = self.frame().FindVariable("rect")
         vtable = rect.GetVTable()
@@ -72,7 +72,7 @@ def test_vtable(self):
         expected_addr = self.expected_vtable_addr(rect)
         self.assertEquals(vtable_addr, expected_addr)
 
-        for (idx, vtable_entry) in enumerate(vtable.children):
+        for idx, vtable_entry in enumerate(vtable.children):
             self.verify_vtable_entry(vtable_entry, vtable_addr, idx)
 
     @skipIf(compiler="clang", compiler_version=["<", "9.0"])
@@ -90,13 +90,11 @@ def test_base_class_ptr(self):
         shape_ptr_vtable = shape_ptr.GetVTable()
         self.assertEquals(shape_ptr_vtable.GetName(), "vtable for Rectangle")
         self.assertEquals(shape_ptr_vtable.GetNumChildren(), 5)
-        self.assertEquals(shape_ptr.GetValueAsUnsigned(0),
-                          rect.GetLoadAddress())
+        self.assertEquals(shape_ptr.GetValueAsUnsigned(0), rect.GetLoadAddress())
         lldbutil.continue_to_source_breakpoint(
             self, process, "Shape is Shape", lldb.SBFileSpec("main.cpp")
         )
-        self.assertEquals(shape_ptr.GetValueAsUnsigned(0),
-                          shape.GetLoadAddress())
+        self.assertEquals(shape_ptr.GetValueAsUnsigned(0), shape.GetLoadAddress())
         self.assertEquals(shape_ptr_vtable.GetNumChildren(), 4)
         self.assertEquals(shape_ptr_vtable.GetName(), "vtable for Shape")
 
@@ -108,12 +106,16 @@ def test_no_vtable(self):
         )
 
         var = self.frame().FindVariable("not_virtual")
-        self.assertEqual(var.GetVTable().GetError().GetCString(),
-                         'type "NotVirtual" doesn\'t have a vtable')
+        self.assertEqual(
+            var.GetVTable().GetError().GetCString(),
+            'type "NotVirtual" doesn\'t have a vtable',
+        )
 
         var = self.frame().FindVariable("argc")
-        self.assertEqual(var.GetVTable().GetError().GetCString(),
-                         'no language runtime support for the language "c"')
+        self.assertEqual(
+            var.GetVTable().GetError().GetCString(),
+            'no language runtime support for the language "c"',
+        )
 
     @skipUnlessPlatform(["linux", "macosx"])
     def test_overwrite_vtable(self):
@@ -161,13 +163,15 @@ def expected_vtable_addr(self, var: lldb.SBValue) -> int:
     def expected_vtable_entry_func_ptr(self, vtable_addr: int, idx: int):
         vtable_entry_addr = vtable_addr + idx * self.process().GetAddressByteSize()
         read_func_ptr_error = lldb.SBError()
-        func_ptr = self.process().ReadPointerFromMemory(vtable_entry_addr,
-                                                        read_func_ptr_error)
+        func_ptr = self.process().ReadPointerFromMemory(
+            vtable_entry_addr, read_func_ptr_error
+        )
         self.assertTrue(read_func_ptr_error.Success())
         return func_ptr
 
-    def verify_vtable_entry(self, vtable_entry: lldb.SBValue, vtable_addr: int,
-                            idx: int):
+    def verify_vtable_entry(
+        self, vtable_entry: lldb.SBValue, vtable_addr: int, idx: int
+    ):
         """Verify the vtable entry looks something like:
 
         (double ()) [0] = 0x0000000100003a10 a.out`Rectangle::Area() at main.cpp:14
@@ -186,8 +190,7 @@ def verify_vtable_entry(self, vtable_entry: lldb.SBValue, vtable_addr: int,
         # Make sure the type is the same as the function type
         func_type = sym_ctx.GetFunction().GetType()
         if func_type.IsValid():
-            self.assertEquals(vtable_entry.GetType(),
-                              func_type.GetPointerType())
+            self.assertEquals(vtable_entry.GetType(), func_type.GetPointerType())
 
         # The summary should be the address description of the function pointer
         summary = vtable_entry.GetSummary()

diff  --git a/lldb/test/API/lang/cpp/union-static-data-members/TestCppUnionStaticMembers.py b/lldb/test/API/lang/cpp/union-static-data-members/TestCppUnionStaticMembers.py
index dff23da8662a04..2047a8fc4dbdf3 100644
--- a/lldb/test/API/lang/cpp/union-static-data-members/TestCppUnionStaticMembers.py
+++ b/lldb/test/API/lang/cpp/union-static-data-members/TestCppUnionStaticMembers.py
@@ -7,6 +7,7 @@
 from lldbsuite.test.decorators import *
 import lldbsuite.test.lldbutil as lldbutil
 
+
 class CppUnionStaticMembersTestCase(TestBase):
     def test_print_union(self):
         """Tests that frame variable and expr work
@@ -20,12 +21,16 @@ def test_print_union(self):
         self.expect("frame variable foo", substrs=["val = 42"])
         self.expect("frame variable bar", substrs=["val = 137"])
 
-        self.expect_expr("foo", result_type="Foo", result_children=[ValueCheck(
-                name="val", value="42"
-            )])
-        self.expect_expr("bar", result_type="Bar", result_children=[ValueCheck(
-                name="val", value="137"
-            )])
+        self.expect_expr(
+            "foo",
+            result_type="Foo",
+            result_children=[ValueCheck(name="val", value="42")],
+        )
+        self.expect_expr(
+            "bar",
+            result_type="Bar",
+            result_children=[ValueCheck(name="val", value="137")],
+        )
 
     @expectedFailureWindows
     def test_expr_union_static_members(self):
@@ -38,15 +43,17 @@ def test_expr_union_static_members(self):
         )
 
         self.expect_expr("Foo::sVal1", result_type="const int", result_value="-42")
-        self.expect_expr("Foo::sVal2", result_type="Foo", result_children=[ValueCheck(
-                name="val", value="42"
-            )])
+        self.expect_expr(
+            "Foo::sVal2",
+            result_type="Foo",
+            result_children=[ValueCheck(name="val", value="42")],
+        )
 
     @expectedFailureWindows
     def test_union_in_anon_namespace(self):
         """Tests that frame variable and expr work
-           for union static data members in anonymous
-           namespaces"""
+        for union static data members in anonymous
+        namespaces"""
         self.build()
 
         (target, process, main_thread, _) = lldbutil.run_to_source_breakpoint(
@@ -54,6 +61,8 @@ def test_union_in_anon_namespace(self):
         )
 
         self.expect_expr("Bar::sVal1", result_type="const int", result_value="-137")
-        self.expect_expr("Bar::sVal2", result_type="Bar", result_children=[ValueCheck(
-                name="val", value="137"
-            )])
+        self.expect_expr(
+            "Bar::sVal2",
+            result_type="Bar",
+            result_children=[ValueCheck(name="val", value="137")],
+        )

diff  --git a/lldb/test/API/lang/cpp/unique-types4/TestUniqueTypes4.py b/lldb/test/API/lang/cpp/unique-types4/TestUniqueTypes4.py
index 30d49ebe09662a..259899ea87f89c 100644
--- a/lldb/test/API/lang/cpp/unique-types4/TestUniqueTypes4.py
+++ b/lldb/test/API/lang/cpp/unique-types4/TestUniqueTypes4.py
@@ -17,27 +17,35 @@ def do_test(self, debug_flags):
         )
         # FIXME: these should successfully print the values
         self.expect(
-            "expression ns::Foo<double>::value", substrs=["'Foo' in namespace 'ns'"], error=True
+            "expression ns::Foo<double>::value",
+            substrs=["'Foo' in namespace 'ns'"],
+            error=True,
         )
         self.expect(
-            "expression ns::Foo<int>::value", substrs=["'Foo' in namespace 'ns'"], error=True
+            "expression ns::Foo<int>::value",
+            substrs=["'Foo' in namespace 'ns'"],
+            error=True,
         )
         self.expect(
-            "expression ns::Bar<double>::value", substrs=["'Bar' in namespace 'ns'"], error=True
+            "expression ns::Bar<double>::value",
+            substrs=["'Bar' in namespace 'ns'"],
+            error=True,
         )
         self.expect(
-            "expression ns::Bar<int>::value", substrs=["'Bar' in namespace 'ns'"], error=True
+            "expression ns::Bar<int>::value",
+            substrs=["'Bar' in namespace 'ns'"],
+            error=True,
         )
         self.expect_expr("ns::FooDouble::value", result_type="double", result_value="0")
         self.expect_expr("ns::FooInt::value", result_type="int", result_value="0")
 
-    @skipIfWindows # https://github.com/llvm/llvm-project/issues/75936
+    @skipIfWindows  # https://github.com/llvm/llvm-project/issues/75936
     @skipIf(compiler=no_match("clang"))
     @skipIf(compiler_version=["<", "15.0"])
     def test_simple_template_names(self):
         self.do_test(dict(CFLAGS_EXTRAS="-gsimple-template-names"))
 
-    @skipIfWindows # https://github.com/llvm/llvm-project/issues/75936
+    @skipIfWindows  # https://github.com/llvm/llvm-project/issues/75936
     @skipIf(compiler=no_match("clang"))
     @skipIf(compiler_version=["<", "15.0"])
     def test_no_simple_template_names(self):

diff  --git a/lldb/test/API/lang/objc/charstar_dyntype/TestCharStarDynType.py b/lldb/test/API/lang/objc/charstar_dyntype/TestCharStarDynType.py
index ab6f0c27fb5237..e65d263e1a2b4b 100644
--- a/lldb/test/API/lang/objc/charstar_dyntype/TestCharStarDynType.py
+++ b/lldb/test/API/lang/objc/charstar_dyntype/TestCharStarDynType.py
@@ -7,6 +7,7 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
+
 class TestCaseCharStarDynType(TestBase):
     def setUp(self):
         # Call super's setUp().

diff  --git a/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py b/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
index 1264df61f2be47..0942dcd655b750 100644
--- a/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
+++ b/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
@@ -12,6 +12,7 @@
 from pathlib import Path
 import time
 
+
 class GlobalModuleCacheTestCase(TestBase):
     # NO_DEBUG_INFO_TESTCASE = True
 
@@ -112,6 +113,7 @@ def do_test(self, one_target, one_debugger):
                 new_debugger = lldb.SBDebugger().Create()
                 self.old_debugger = self.dbg
                 self.dbg = new_debugger
+
                 def cleanupDebugger(self):
                     lldb.SBDebugger.Destroy(self.dbg)
                     self.dbg = self.old_debugger
@@ -143,7 +145,7 @@ def cleanupDebugger(self):
         fail_msg = ""
         if error != "":
             fail_msg = "Error before MPD: " + error
-            
+
         if error_after_mpd != "":
             fail_msg = fail_msg + "\nError after MPD: " + error_after_mpd
         if fail_msg != "":
@@ -172,11 +174,13 @@ def check_image_list_result(self, num_a_dot_out, num_main_dot_o):
                 found_a_dot_out += 1
             if "main.o" in line:
                 found_main_dot_o += 1
-        
+
         if num_a_dot_out != found_a_dot_out:
             return f"Got {found_a_dot_out} number of a.out's, expected {num_a_dot_out}"
-            
+
         if found_main_dot_o > 0 and num_main_dot_o != found_main_dot_o:
-            return f"Got {found_main_dot_o} number of main.o's, expected {num_main_dot_o}"
+            return (
+                f"Got {found_main_dot_o} number of main.o's, expected {num_main_dot_o}"
+            )
 
         return ""

diff  --git a/lldb/test/API/python_api/process/cancel_attach/TestCancelAttach.py b/lldb/test/API/python_api/process/cancel_attach/TestCancelAttach.py
index 9172c3d333fd1b..9f643d50e58fc0 100644
--- a/lldb/test/API/python_api/process/cancel_attach/TestCancelAttach.py
+++ b/lldb/test/API/python_api/process/cancel_attach/TestCancelAttach.py
@@ -28,10 +28,12 @@ def __init__(self, target, error):
                 threading.Thread.__init__(self, daemon=True)
                 self.target = target
                 self.error = error
-                
+
             def run(self):
-                self.target.AttachToProcessWithName(lldb.SBListener(), "LLDB-No-Such-Process", True, self.error)
-                
+                self.target.AttachToProcessWithName(
+                    lldb.SBListener(), "LLDB-No-Such-Process", True, self.error
+                )
+
         error = lldb.SBError()
         thread = AttachThread(target, error)
         thread.start()
@@ -50,8 +52,7 @@ def run(self):
         # We don't want to stall if we can't interrupt, so join with a timeout:
         thread.join(60)
         if thread.is_alive():
-          self.fail("The attach thread is alive after timeout interval")
+            self.fail("The attach thread is alive after timeout interval")
 
         # Now check the error, should say the attach was interrupted:
         self.assertTrue(error.Fail(), "We succeeded in not attaching")
-

diff  --git a/lldb/test/API/python_api/value/TestValueAPI.py b/lldb/test/API/python_api/value/TestValueAPI.py
index 75052671d8d26c..18376f76e3c850 100644
--- a/lldb/test/API/python_api/value/TestValueAPI.py
+++ b/lldb/test/API/python_api/value/TestValueAPI.py
@@ -212,7 +212,9 @@ def test(self):
             frame0.FindVariable("fixed_int_ptr").GetValue(),
             "0x000000aa" if target.addr_size == 4 else "0x00000000000000aa",
         )
-        self.runCmd("settings set target.show-hex-variable-values-with-leading-zeroes false")
+        self.runCmd(
+            "settings set target.show-hex-variable-values-with-leading-zeroes false"
+        )
         self.assertEqual(
             frame0.FindVariable("another_fixed_int_ptr").GetValue(),
             "0xaa",

diff  --git a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_logpoints.py b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_logpoints.py
index 2367313b095ea2..6010052cd07d6c 100644
--- a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_logpoints.py
+++ b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_logpoints.py
@@ -77,7 +77,9 @@ def test_logmessage_basic(self):
         # Verify log message match
         for idx, logMessage_line in enumerate(logMessage_output):
             result = idx + 3
-            reg_str = f"{logMessage_prefix}{result}, {message_addr_pattern} {message_content}"
+            reg_str = (
+                f"{logMessage_prefix}{result}, {message_addr_pattern} {message_content}"
+            )
             self.assertRegex(logMessage_line, reg_str)
 
     @skipIfWindows


        


More information about the lldb-commits mailing list