diff options
Diffstat (limited to 'test/py/tests/test_fit_hashes.py')
-rw-r--r-- | test/py/tests/test_fit_hashes.py | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/test/py/tests/test_fit_hashes.py b/test/py/tests/test_fit_hashes.py index 4891e77ca2d..07bf0fd5211 100644 --- a/test/py/tests/test_fit_hashes.py +++ b/test/py/tests/test_fit_hashes.py @@ -12,7 +12,7 @@ This test doesn't run the sandbox. It only checks the host tool 'mkimage' import os import pytest -import u_boot_utils as util +import utils kernel_hashes = { "sha512" : "f18c1486a2c29f56360301576cdfce4dfd8e8e932d0ed8e239a1f314b8ae1d77b2a58cd7fe32e4075e69448e623ce53b0b6aa6ce5626d2c189a5beae29a68d93", @@ -26,20 +26,21 @@ kernel_hashes = { class ReadonlyFitImage(object): """ Helper to manipulate a FIT image on disk """ - def __init__(self, cons, file_name): + def __init__(self, ubman, file_name): self.fit = file_name - self.cons = cons + self.ubman = ubman self.hashable_nodes = set() def __fdt_list(self, path): - return util.run_and_log(self.cons, f'fdtget -l {self.fit} {path}') + return utils.run_and_log(self.ubman, f'fdtget -l {self.fit} {path}') def __fdt_get(self, node, prop): - val = util.run_and_log(self.cons, f'fdtget {self.fit} {node} {prop}') + val = utils.run_and_log(self.ubman, f'fdtget {self.fit} {node} {prop}') return val.rstrip('\n') def __fdt_get_sexadecimal(self, node, prop): - numbers = util.run_and_log(self.cons, f'fdtget -tbx {self.fit} {node} {prop}') + numbers = utils.run_and_log(self.ubman, + f'fdtget -tbx {self.fit} {node} {prop}') sexadecimal = '' for num in numbers.rstrip('\n').split(' '): @@ -80,21 +81,21 @@ class ReadonlyFitImage(object): @pytest.mark.requiredtool('dtc') @pytest.mark.requiredtool('fdtget') @pytest.mark.requiredtool('fdtput') -def test_mkimage_hashes(u_boot_console): +def test_mkimage_hashes(ubman): """ Test that hashes generated by mkimage are correct. """ def assemble_fit_image(dest_fit, its, destdir): dtc_args = f'-I dts -O dtb -i {destdir}' - util.run_and_log(cons, [mkimage, '-D', dtc_args, '-f', its, dest_fit]) + utils.run_and_log(ubman, [mkimage, '-D', dtc_args, '-f', its, dest_fit]) def dtc(dts): dtb = dts.replace('.dts', '.dtb') - util.run_and_log(cons, f'dtc {datadir}/{dts} -O dtb -o {tempdir}/{dtb}') + utils.run_and_log(ubman, + f'dtc {datadir}/{dts} -O dtb -o {tempdir}/{dtb}') - cons = u_boot_console - mkimage = cons.config.build_dir + '/tools/mkimage' - datadir = cons.config.source_dir + '/test/py/tests/vboot/' - tempdir = os.path.join(cons.config.result_dir, 'hashes') + mkimage = ubman.config.build_dir + '/tools/mkimage' + datadir = ubman.config.source_dir + '/test/py/tests/vboot/' + tempdir = os.path.join(ubman.config.result_dir, 'hashes') os.makedirs(tempdir, exist_ok=True) fit_file = f'{tempdir}/test.fit' @@ -106,7 +107,7 @@ def test_mkimage_hashes(u_boot_console): assemble_fit_image(fit_file, f'{datadir}/hash-images.its', tempdir) - fit = ReadonlyFitImage(cons, fit_file) + fit = ReadonlyFitImage(ubman, fit_file) nodes = fit.find_hashable_image_nodes() if len(nodes) == 0: raise ValueError('FIT image has no "/image" nodes with "hash-..."') |