summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.azure-pipelines.yml2
-rw-r--r--.gitlab-ci.yml2
-rw-r--r--test/py/tests/test_spi.py44
-rw-r--r--test/py/tests/test_ums.py40
-rw-r--r--test/py/tests/test_usb.py2
-rw-r--r--tools/binman/etype/fdtmap.py5
-rw-r--r--tools/binman/etype/image_header.py1
-rw-r--r--tools/binman/etype/pre_load.py2
-rw-r--r--tools/binman/etype/ti_board_config.py2
-rw-r--r--tools/binman/etype/x509_cert.py1
-rw-r--r--tools/binman/ftest.py1
-rw-r--r--tools/binman/setup.py2
-rw-r--r--tools/binman/state.py3
-rw-r--r--tools/buildman/builder.py6
-rw-r--r--tools/dtoc/setup.py2
-rwxr-xr-xtools/microcode-tool.py3
-rw-r--r--tools/patman/test_checkpatch.py1
17 files changed, 64 insertions, 55 deletions
diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index 1f2766eae16..d5cfa59a8a6 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -173,7 +173,7 @@ stages:
-r tools/buildman/requirements.txt \
-r tools/patman/requirements.txt \
-r tools/u_boot_pylib/requirements.txt \
- asteval pylint==2.12.2 pyopenssl
+ asteval pylint==3.3.4 pyopenssl
export PATH=${PATH}:~/.local/bin
echo "[MASTER]" >> .pylintrc
echo "load-plugins=pylint.extensions.docparams" >> .pylintrc
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e339c25f5e1..64f92f8b5b9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -210,7 +210,7 @@ Run pylint:
- . /tmp/venv/bin/activate
- pip install -r test/py/requirements.txt -r tools/binman/requirements.txt
-r tools/buildman/requirements.txt -r tools/patman/requirements.txt
- -r tools/u_boot_pylib/requirements.txt asteval pylint==2.12.2 pyopenssl
+ -r tools/u_boot_pylib/requirements.txt asteval pylint==3.3.4 pyopenssl
- export PATH=${PATH}:~/.local/bin
- echo "[MASTER]" >> .pylintrc
- echo "load-plugins=pylint.extensions.docparams" >> .pylintrc
diff --git a/test/py/tests/test_spi.py b/test/py/tests/test_spi.py
index 0abdfa78b76..d57db9178e9 100644
--- a/test/py/tests/test_spi.py
+++ b/test/py/tests/test_spi.py
@@ -119,37 +119,35 @@ def spi_pre_commands(u_boot_console, freq):
pytest.fail('Not recognized the SPI flash part name')
m = re.search('page size (.+?) Bytes', output)
- if m:
- try:
- page_size = int(m.group(1))
- except ValueError:
- pytest.fail('Not recognized the SPI page size')
+ assert m
+ try:
+ page_size = int(m.group(1))
+ except ValueError:
+ pytest.fail('Not recognized the SPI page size')
m = re.search('erase size (.+?) KiB', output)
- if m:
- try:
- erase_size = int(m.group(1))
- except ValueError:
- pytest.fail('Not recognized the SPI erase size')
-
+ assert m
+ try:
+ erase_size = int(m.group(1))
erase_size *= 1024
+ except ValueError:
+ pytest.fail('Not recognized the SPI erase size')
m = re.search('total (.+?) MiB', output)
- if m:
- try:
- total_size = int(m.group(1))
- except ValueError:
- pytest.fail('Not recognized the SPI total size')
-
+ assert m
+ try:
+ total_size = int(m.group(1))
total_size *= 1024 * 1024
+ except ValueError:
+ pytest.fail('Not recognized the SPI total size')
m = re.search('Detected (.+?) with', output)
- if m:
- try:
- flash_part = m.group(1)
- assert flash_part == part_name
- except ValueError:
- pytest.fail('Not recognized the SPI flash part')
+ assert m
+ try:
+ flash_part = m.group(1)
+ assert flash_part == part_name
+ except ValueError:
+ pytest.fail('Not recognized the SPI flash part')
global SPI_DATA
SPI_DATA = {
diff --git a/test/py/tests/test_ums.py b/test/py/tests/test_ums.py
index 749b1606235..387571c5140 100644
--- a/test/py/tests/test_ums.py
+++ b/test/py/tests/test_ums.py
@@ -113,14 +113,12 @@ def test_ums(u_boot_console, env__usb_dev_port, env__block_devs):
mount_subdir = env__block_devs[0]['writable_fs_subdir']
part_num = env__block_devs[0]['writable_fs_partition']
host_ums_part_node = '%s-part%d' % (host_ums_dev_node, part_num)
+ test_f = u_boot_utils.PersistentRandomFile(u_boot_console, 'ums.bin',
+ 1024 * 1024);
+ mounted_test_fn = mount_point + '/' + mount_subdir + test_f.fn
else:
host_ums_part_node = host_ums_dev_node
- test_f = u_boot_utils.PersistentRandomFile(u_boot_console, 'ums.bin',
- 1024 * 1024);
- if have_writable_fs_partition:
- mounted_test_fn = mount_point + '/' + mount_subdir + test_f.fn
-
def start_ums():
"""Start U-Boot's ums shell command.
@@ -197,25 +195,23 @@ def test_ums(u_boot_console, env__usb_dev_port, env__block_devs):
ignore_errors)
ignore_cleanup_errors = True
- try:
- start_ums()
- if not have_writable_fs_partition:
- # Skip filesystem-based testing if not configured
- return
+ if have_writable_fs_partition:
try:
- mount()
- u_boot_console.log.action('Writing test file via UMS')
- cmd = ('rm', '-f', mounted_test_fn)
- u_boot_utils.run_and_log(u_boot_console, cmd)
- if os.path.exists(mounted_test_fn):
- raise Exception('Could not rm target UMS test file')
- cmd = ('cp', test_f.abs_fn, mounted_test_fn)
- u_boot_utils.run_and_log(u_boot_console, cmd)
- ignore_cleanup_errors = False
+ start_ums()
+ try:
+ mount()
+ u_boot_console.log.action('Writing test file via UMS')
+ cmd = ('rm', '-f', mounted_test_fn)
+ u_boot_utils.run_and_log(u_boot_console, cmd)
+ if os.path.exists(mounted_test_fn):
+ raise Exception('Could not rm target UMS test file')
+ cmd = ('cp', test_f.abs_fn, mounted_test_fn)
+ u_boot_utils.run_and_log(u_boot_console, cmd)
+ ignore_cleanup_errors = False
+ finally:
+ umount(ignore_errors=ignore_cleanup_errors)
finally:
- umount(ignore_errors=ignore_cleanup_errors)
- finally:
- stop_ums(ignore_errors=ignore_cleanup_errors)
+ stop_ums(ignore_errors=ignore_cleanup_errors)
ignore_cleanup_errors = True
try:
diff --git a/test/py/tests/test_usb.py b/test/py/tests/test_usb.py
index 566d73b7c64..9bef883325f 100644
--- a/test/py/tests/test_usb.py
+++ b/test/py/tests/test_usb.py
@@ -580,6 +580,8 @@ def test_usb_load(u_boot_console):
elif fs in ['ext4', 'ext2']:
file, size, expected_crc32 = \
usb_ext4load_ext4write(u_boot_console, fs, x, part)
+ else:
+ raise Exception('Unsupported filesystem type %s' % fs)
offset = random.randrange(128, 1024, 128)
output = u_boot_console.run_command(
diff --git a/tools/binman/etype/fdtmap.py b/tools/binman/etype/fdtmap.py
index f1f6217940f..2259404180c 100644
--- a/tools/binman/etype/fdtmap.py
+++ b/tools/binman/etype/fdtmap.py
@@ -106,6 +106,9 @@ class Entry_fdtmap(Entry):
Returns:
FDT map binary data
"""
+ fsw = libfdt.FdtSw()
+ fsw.finish_reservemap()
+
def _AddNode(node):
"""Add a node to the FDT map"""
for pname, prop in node.props.items():
@@ -134,8 +137,6 @@ class Entry_fdtmap(Entry):
# Build a new tree with all nodes and properties starting from that
# node
- fsw = libfdt.FdtSw()
- fsw.finish_reservemap()
with fsw.add_node(''):
fsw.property_string('image-node', node.name)
_AddNode(node)
diff --git a/tools/binman/etype/image_header.py b/tools/binman/etype/image_header.py
index 24011884958..2114df8159f 100644
--- a/tools/binman/etype/image_header.py
+++ b/tools/binman/etype/image_header.py
@@ -62,6 +62,7 @@ class Entry_image_header(Entry):
def _GetHeader(self):
image_pos = self.GetSiblingImagePos('fdtmap')
+ offset = None
if image_pos == False:
self.Raise("'image_header' section must have an 'fdtmap' sibling")
elif image_pos is None:
diff --git a/tools/binman/etype/pre_load.py b/tools/binman/etype/pre_load.py
index 2e4c72359ff..00f1a896767 100644
--- a/tools/binman/etype/pre_load.py
+++ b/tools/binman/etype/pre_load.py
@@ -112,6 +112,8 @@ class Entry_pre_load(Entry_collection):
# Compute the signature
if padding_name is None:
padding_name = "pkcs-1.5"
+ padding = None
+ padding_args = None
if padding_name == "pss":
salt_len = key.size_in_bytes() - hash_image.digest_size - 2
padding = pss
diff --git a/tools/binman/etype/ti_board_config.py b/tools/binman/etype/ti_board_config.py
index c10d66edcb1..7c6773ac7bc 100644
--- a/tools/binman/etype/ti_board_config.py
+++ b/tools/binman/etype/ti_board_config.py
@@ -119,12 +119,14 @@ class Entry_ti_board_config(Entry_section):
array of bytes representing value
"""
size = 0
+ br = bytearray()
if (data_type == '#/definitions/u8'):
size = 1
elif (data_type == '#/definitions/u16'):
size = 2
else:
size = 4
+ br = None
if type(val) == int:
br = val.to_bytes(size, byteorder='little')
return br
diff --git a/tools/binman/etype/x509_cert.py b/tools/binman/etype/x509_cert.py
index 29630d1b86c..25e6808b7f9 100644
--- a/tools/binman/etype/x509_cert.py
+++ b/tools/binman/etype/x509_cert.py
@@ -84,6 +84,7 @@ class Entry_x509_cert(Entry_collection):
input_fname = tools.get_output_filename('input.%s' % uniq)
config_fname = tools.get_output_filename('config.%s' % uniq)
tools.write_file(input_fname, input_data)
+ stdout = None
if type == 'generic':
stdout = self.openssl.x509_cert(
cert_fname=output_fname,
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index a553ca9e564..d2802f67e2d 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -6381,6 +6381,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
ename, prop = entry_m.group(1), entry_m.group(3)
entry, entry_name, prop_name = image.LookupEntry(entries,
name, msg)
+ expect_val = None
if prop_name == 'offset':
expect_val = entry.offset
elif prop_name == 'image_pos':
diff --git a/tools/binman/setup.py b/tools/binman/setup.py
index 9a9206eb044..bec078a3d9b 100644
--- a/tools/binman/setup.py
+++ b/tools/binman/setup.py
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0+
-from distutils.core import setup
+from setuptools import setup
setup(name='binman',
version='1.0',
license='GPL-2.0+',
diff --git a/tools/binman/state.py b/tools/binman/state.py
index 45bae40c525..6772d3678fe 100644
--- a/tools/binman/state.py
+++ b/tools/binman/state.py
@@ -406,10 +406,13 @@ def CheckSetHashValue(node, get_data_func):
hash_node = node.FindNode('hash')
if hash_node:
algo = hash_node.props.get('algo').value
+ data = None
if algo == 'sha256':
m = hashlib.sha256()
m.update(get_data_func())
data = m.digest()
+ if data is None:
+ raise ValueError(f"Node '{node.path}': Unknown hash algorithm '{algo}'")
for n in GetUpdateNodes(hash_node):
n.SetData('value', data)
diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 2568e4e8423..23b1016d0f9 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -1095,14 +1095,13 @@ class Builder:
diff = result[name]
if name.startswith('_'):
continue
- if diff != 0:
- color = self.col.RED if diff > 0 else self.col.GREEN
+ colour = self.col.RED if diff > 0 else self.col.GREEN
msg = ' %s %+d' % (name, diff)
if not printed_target:
tprint('%10s %-15s:' % ('', result['_target']),
newline=False)
printed_target = True
- tprint(msg, colour=color, newline=False)
+ tprint(msg, colour=colour, newline=False)
if printed_target:
tprint()
if show_bloat:
@@ -1353,6 +1352,7 @@ class Builder:
for line in lines:
if not line:
continue
+ col = None
if line[0] == '+':
col = self.col.GREEN
elif line[0] == '-':
diff --git a/tools/dtoc/setup.py b/tools/dtoc/setup.py
index 5e092fe0872..ae9ad043b01 100644
--- a/tools/dtoc/setup.py
+++ b/tools/dtoc/setup.py
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0+
-from distutils.core import setup
+from setuptools import setup
setup(name='dtoc',
version='1.0',
license='GPL-2.0+',
diff --git a/tools/microcode-tool.py b/tools/microcode-tool.py
index 24c02c4fca1..b726794751a 100755
--- a/tools/microcode-tool.py
+++ b/tools/microcode-tool.py
@@ -279,6 +279,9 @@ def MicrocodeTool():
if (not not options.mcfile) != (not not options.mcfile):
parser.error("You must specify either header files or a microcode file, not both")
+ date = None
+ microcodes = None
+ license_text = None
if options.headerfile:
date, license_text, microcodes = ParseHeaderFiles(options.headerfile)
elif options.mcfile:
diff --git a/tools/patman/test_checkpatch.py b/tools/patman/test_checkpatch.py
index 11d003bc4e7..3bf16febbf6 100644
--- a/tools/patman/test_checkpatch.py
+++ b/tools/patman/test_checkpatch.py
@@ -530,4 +530,3 @@ index 0000000..2234c87
if __name__ == "__main__":
unittest.main()
- gitutil.RunTests()