Skip to content

Commit c2ca52d

Browse files
Kevin Freikevinfrei
Kevin Frei
authored andcommitted
Fixed formatting for the Python tests
1 parent 972b8e2 commit c2ca52d

File tree

2 files changed

+69
-20
lines changed

2 files changed

+69
-20
lines changed

lldb/test/API/debuginfod/Normal/TestDebuginfod.py

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def getUUID(aoutuuid):
2222
if len(header) != 4:
2323
return None
2424
# 4 element 'prefix', 20 bytes of uuid, 3 byte long string: 'GNU':
25-
if header[0] != 4 or header[1] != 20 or header[2] != 3 or header[3] != 0x554e47:
25+
if header[0] != 4 or header[1] != 20 or header[2] != 3 or header[3] != 0x554E47:
2626
return None
2727
return data[16:].hex()
2828

@@ -35,6 +35,8 @@ def getUUID(aoutuuid):
3535
1 - A stripped binary with it's corresponding unstripped binary:
3636
2 - A stripped binary with a corresponding --only-keep-debug symbols file
3737
"""
38+
39+
3840
@skipUnlessPlatform(["linux", "freebsd"])
3941
class DebugInfodTests(TestBase):
4042
# No need to try every flavor of debug inf.
@@ -99,14 +101,21 @@ def try_breakpoint(self, should_have_loc):
99101
addr = loc.GetAddress()
100102
self.assertTrue(addr and addr.IsValid(), "Loc address is valid")
101103
line_entry = addr.GetLineEntry()
102-
self.assertEqual(should_have_loc, line_entry != None and line_entry.IsValid(), "Loc line entry is valid")
104+
self.assertEqual(
105+
should_have_loc,
106+
line_entry != None and line_entry.IsValid(),
107+
"Loc line entry is valid",
108+
)
103109
if should_have_loc:
104110
self.assertEqual(line_entry.GetLine(), 4)
105-
self.assertEqual(line_entry.GetFileSpec().GetFilename(), self.main_source_file.GetFilename())
111+
self.assertEqual(
112+
line_entry.GetFileSpec().GetFilename(),
113+
self.main_source_file.GetFilename(),
114+
)
106115
self.dbg.DeleteTarget(target)
107116
shutil.rmtree(self.tmp_dir)
108117

109-
def config_test(self, local_files, debuginfo = None, executable = None):
118+
def config_test(self, local_files, debuginfo=None, executable=None):
110119
"""
111120
Set up a test with local_files[] copied to a different location
112121
so that we control which files are, or are not, found in the file system.
@@ -138,7 +147,7 @@ def config_test(self, local_files, debuginfo = None, executable = None):
138147
for f in local_files:
139148
shutil.copy(self.getBuildArtifact(f), test_dir)
140149
# The first item is the binary to be used for the test
141-
if (self.aout == ""):
150+
if self.aout == "":
142151
self.aout = os.path.join(test_dir, f)
143152

144153
use_debuginfod = debuginfo != None or executable != None
@@ -149,13 +158,28 @@ def config_test(self, local_files, debuginfo = None, executable = None):
149158
uuid_dir = os.path.join(self.tmp_dir, "buildid", uuid)
150159
os.makedirs(uuid_dir)
151160
if debuginfo:
152-
shutil.copy(self.getBuildArtifact(debuginfo), os.path.join(uuid_dir, "debuginfo"))
161+
shutil.copy(
162+
self.getBuildArtifact(debuginfo),
163+
os.path.join(uuid_dir, "debuginfo"),
164+
)
153165
if executable:
154-
shutil.copy(self.getBuildArtifact(executable), os.path.join(uuid_dir, "executable"))
166+
shutil.copy(
167+
self.getBuildArtifact(executable),
168+
os.path.join(uuid_dir, "executable"),
169+
)
155170

156171
# Configure LLDB for the test:
157-
self.runCmd("settings set symbols.enable-external-lookup %s" % str(use_debuginfod).lower())
172+
self.runCmd(
173+
"settings set symbols.enable-external-lookup %s"
174+
% str(use_debuginfod).lower()
175+
)
158176
self.runCmd("settings clear plugin.symbol-locator.debuginfod.server-urls")
159177
if use_debuginfod:
160-
self.runCmd("settings set plugin.symbol-locator.debuginfod.cache-path %s/cache" % self.tmp_dir)
161-
self.runCmd("settings insert-before plugin.symbol-locator.debuginfod.server-urls 0 file://%s" % self.tmp_dir)
178+
self.runCmd(
179+
"settings set plugin.symbol-locator.debuginfod.cache-path %s/cache"
180+
% self.tmp_dir
181+
)
182+
self.runCmd(
183+
"settings insert-before plugin.symbol-locator.debuginfod.server-urls 0 file://%s"
184+
% self.tmp_dir
185+
)

lldb/test/API/debuginfod/SplitDWARF/TestDebuginfodDWP.py

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@ def getUUID(aoutuuid):
2525
if len(header) != 4:
2626
return None
2727
# 4 element 'prefix', 20 bytes of uuid, 3 byte long string: 'GNU':
28-
if header[0] != 4 or header[1] != 20 or header[2] != 3 or header[3] != 0x554e47:
28+
if header[0] != 4 or header[1] != 20 or header[2] != 3 or header[3] != 0x554E47:
2929
return None
3030
return data[16:].hex()
3131

32+
3233
"""
3334
Test support for the DebugInfoD network symbol acquisition protocol.
3435
This file is for split-dwarf (dwp) scenarios.
@@ -37,6 +38,8 @@ def getUUID(aoutuuid):
3738
2 - A stripped, split binary target with an unstripped binary and a DWP file
3839
3 - A stripped, split binary target with an --only-keep-debug symbols file and a DWP file
3940
"""
41+
42+
4043
@skipUnlessPlatform(["linux", "freebsd"])
4144
class DebugInfodDWPTests(TestBase):
4245
# No need to try every flavor of debug inf.
@@ -108,14 +111,21 @@ def try_breakpoint(self, should_have_loc):
108111
addr = loc.GetAddress()
109112
self.assertTrue(addr and addr.IsValid(), "Loc address is valid")
110113
line_entry = addr.GetLineEntry()
111-
self.assertEqual(should_have_loc, line_entry != None and line_entry.IsValid(), "Loc line entry is valid")
114+
self.assertEqual(
115+
should_have_loc,
116+
line_entry != None and line_entry.IsValid(),
117+
"Loc line entry is valid",
118+
)
112119
if should_have_loc:
113120
self.assertEqual(line_entry.GetLine(), 4)
114-
self.assertEqual(line_entry.GetFileSpec().GetFilename(), self.main_source_file.GetFilename())
121+
self.assertEqual(
122+
line_entry.GetFileSpec().GetFilename(),
123+
self.main_source_file.GetFilename(),
124+
)
115125
self.dbg.DeleteTarget(target)
116126
shutil.rmtree(self.tmp_dir)
117127

118-
def config_test(self, local_files, debuginfo = None, executable = None):
128+
def config_test(self, local_files, debuginfo=None, executable=None):
119129
"""
120130
Set up a test with local_files[] copied to a different location
121131
so that we control which files are, or are not, found in the file system.
@@ -146,7 +156,7 @@ def config_test(self, local_files, debuginfo = None, executable = None):
146156
# Copy the files used by the test:
147157
for f in local_files:
148158
shutil.copy(self.getBuildArtifact(f), self.test_dir)
149-
if (self.aout == ""):
159+
if self.aout == "":
150160
self.aout = os.path.join(self.test_dir, f)
151161

152162
use_debuginfod = debuginfo != None or executable != None
@@ -157,13 +167,28 @@ def config_test(self, local_files, debuginfo = None, executable = None):
157167
uuid_dir = os.path.join(self.tmp_dir, "buildid", uuid)
158168
os.makedirs(uuid_dir)
159169
if debuginfo:
160-
shutil.copy(self.getBuildArtifact(debuginfo), os.path.join(uuid_dir, "debuginfo"))
170+
shutil.copy(
171+
self.getBuildArtifact(debuginfo),
172+
os.path.join(uuid_dir, "debuginfo"),
173+
)
161174
if executable:
162-
shutil.copy(self.getBuildArtifact(executable), os.path.join(uuid_dir, "executable"))
175+
shutil.copy(
176+
self.getBuildArtifact(executable),
177+
os.path.join(uuid_dir, "executable"),
178+
)
163179
os.remove(self.getBuildArtifact("main.dwo"))
164180
# Configure LLDB for the test:
165-
self.runCmd("settings set symbols.enable-external-lookup %s" % str(use_debuginfod).lower())
181+
self.runCmd(
182+
"settings set symbols.enable-external-lookup %s"
183+
% str(use_debuginfod).lower()
184+
)
166185
self.runCmd("settings clear plugin.symbol-locator.debuginfod.server-urls")
167186
if use_debuginfod:
168-
self.runCmd("settings set plugin.symbol-locator.debuginfod.cache-path %s/cache" % self.tmp_dir)
169-
self.runCmd("settings insert-before plugin.symbol-locator.debuginfod.server-urls 0 file://%s" % self.tmp_dir)
187+
self.runCmd(
188+
"settings set plugin.symbol-locator.debuginfod.cache-path %s/cache"
189+
% self.tmp_dir
190+
)
191+
self.runCmd(
192+
"settings insert-before plugin.symbol-locator.debuginfod.server-urls 0 file://%s"
193+
% self.tmp_dir
194+
)

0 commit comments

Comments
 (0)