Skip to content

Commit 6bf923d

Browse files
committed
[lldb][Tests] Reformat API tests with black
These are all recent additions I think, including a few of mine for AArch64. Going forward the CI checks should help us fix these earlier.
1 parent 62bec3d commit 6bf923d

File tree

11 files changed

+215
-114
lines changed

11 files changed

+215
-114
lines changed

lldb/test/API/commands/gui/spawn-threads/TestGuiSpawnThreads.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import sys
1212

13+
1314
class TestGuiSpawnThreadsTest(PExpectTest):
1415
# PExpect uses many timeouts internally and doesn't play well
1516
# under ASAN on a loaded machine..
@@ -18,12 +19,14 @@ class TestGuiSpawnThreadsTest(PExpectTest):
1819
def test_gui(self):
1920
self.build()
2021

21-
self.launch(executable=self.getBuildArtifact('a.out'), dimensions=(100, 500))
22+
self.launch(executable=self.getBuildArtifact("a.out"), dimensions=(100, 500))
2223
self.expect(
23-
'breakpoint set -f main.cpp -p "break here"', substrs=['Breakpoint 1', 'address =']
24+
'breakpoint set -f main.cpp -p "break here"',
25+
substrs=["Breakpoint 1", "address ="],
2426
)
2527
self.expect(
26-
'breakpoint set -f main.cpp -p "before join"', substrs=['Breakpoint 2', 'address =']
28+
'breakpoint set -f main.cpp -p "before join"',
29+
substrs=["Breakpoint 2", "address ="],
2730
)
2831
self.expect("run", substrs=["stop reason ="])
2932

lldb/test/API/commands/register/register/aarch64_mte_ctrl_register/TestMTECtrlRegister.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ def test_mte_ctrl_register(self):
4747
# This would return to synchronous faults if we did not restore the
4848
# previous value.
4949
self.expect("expression setup_mte()", substrs=["= 0"])
50-
self.expect("register read mte_ctrl", substrs=["0x0000000000000005"])
50+
self.expect("register read mte_ctrl", substrs=["0x0000000000000005"])

lldb/test/API/commands/register/register/aarch64_sve_simd_registers/TestSVESIMDRegisters.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ def check_simd_values(self, value_offset):
5252
# These are 128 bit registers, so getting them from the API as unsigned
5353
# values doesn't work. Check the command output instead.
5454
for i in range(32):
55-
self.expect("register read v{}".format(i),
56-
substrs=[self.make_simd_value(i+value_offset)])
55+
self.expect(
56+
"register read v{}".format(i),
57+
substrs=[self.make_simd_value(i + value_offset)],
58+
)
5759

5860
def sve_simd_registers_impl(self, mode):
5961
self.skip_if_needed(mode)

lldb/test/API/functionalities/archives/TestBSDArchives.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ def test(self):
7070
)
7171
self.expect_var_path("__b_global", type="int", value="2")
7272

73-
7473
def check_frame_variable_errors(self, thread, error_strings):
7574
command_result = lldb.SBCommandReturnObject()
7675
interp = self.dbg.GetCommandInterpreter()
@@ -173,7 +172,6 @@ def test_archive_specifications(self):
173172
self.assertEqual(spec.GetObjectName(), "b.o")
174173
self.assertEqual(spec.GetObjectSize(), size_b, libfoothin_path)
175174

176-
177175
@skipIfRemote
178176
@skipUnlessDarwin
179177
def test_frame_var_errors_when_thin_archive_malformed(self):

lldb/test/API/functionalities/dyld-multiple-rdebug/TestDyldWithMultupleRDebug.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@ def test(self):
2626
# in the main executable. Setting breakpoints by file and line ensures
2727
# that the main executable was loaded correctly by the dynamic loader
2828
(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
29-
self, "// Break here", lldb.SBFileSpec("main.cpp"),
30-
extra_images=["testlib"]
29+
self, "// Break here", lldb.SBFileSpec("main.cpp"), extra_images=["testlib"]
3130
)
3231
# Set breakpoints both on shared library function to ensure that
3332
# we hit a source breakpoint in the shared library which only will
3433
# happen if we load the shared library correctly in the dynamic
3534
# loader.
3635
lldbutil.continue_to_source_breakpoint(
37-
self, process, "// Library break here",
38-
lldb.SBFileSpec("library_file.cpp", False)
36+
self,
37+
process,
38+
"// Library break here",
39+
lldb.SBFileSpec("library_file.cpp", False),
3940
)

lldb/test/API/functionalities/interactive_scripted_process/TestInteractiveScriptedProcess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def setUp(self):
2525
# These tests are flakey and sometimes timeout. They work most of the time
2626
# so the basic event flow is right, but somehow the handling is off.
2727
@skipUnlessDarwin
28-
@skipIfDarwin
28+
@skipIfDarwin
2929
def test_passthrough_launch(self):
3030
"""Test a simple pass-through process launch"""
3131
self.passthrough_launch()

lldb/test/API/lang/rust/enum-structs/RustEnumValue.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
DISCRIMINANT_MEMBER_NAME = "$discr$"
55
VALUE_MEMBER_NAME = "value"
66

7-
class RustEnumValue:
87

8+
class RustEnumValue:
99
def __init__(self, value: lldb.SBValue):
1010
self.value = value
1111

@@ -19,7 +19,11 @@ def _inner(self) -> lldb.SBValue:
1919
return self.value.GetChildAtIndex(0)
2020

2121
def getVariantByIndex(self, index):
22-
return self._inner().GetChildAtIndex(index).GetChildMemberWithName(VALUE_MEMBER_NAME)
22+
return (
23+
self._inner()
24+
.GetChildAtIndex(index)
25+
.GetChildMemberWithName(VALUE_MEMBER_NAME)
26+
)
2327

2428
@staticmethod
2529
def _getDiscriminantValueAsUnsigned(discr_sbvalue: lldb.SBValue):
@@ -42,10 +46,12 @@ def _getDiscriminantValueAsUnsigned(discr_sbvalue: lldb.SBValue):
4246
def getCurrentVariantIndex(self):
4347
default_index = 0
4448
for i in range(self._inner().GetNumChildren()):
45-
variant: lldb.SBValue = self._inner().GetChildAtIndex(i);
49+
variant: lldb.SBValue = self._inner().GetChildAtIndex(i)
4650
discr = variant.GetChildMemberWithName(DISCRIMINANT_MEMBER_NAME)
4751
if discr.IsValid():
48-
discr_unsigned_value = RustEnumValue._getDiscriminantValueAsUnsigned(discr)
52+
discr_unsigned_value = RustEnumValue._getDiscriminantValueAsUnsigned(
53+
discr
54+
)
4955
if variant.GetName() == f"$variant${discr_unsigned_value}":
5056
return discr_unsigned_value
5157
else:

0 commit comments

Comments
 (0)