
Simplify this test-setup code by using the helper. Signed-off-by: Simon Glass <sjg@chromium.org> --- test/py/tests/test_ut.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/test/py/tests/test_ut.py b/test/py/tests/test_ut.py index 85ba6e3f5c3..cb992a873c6 100644 --- a/test/py/tests/test_ut.py +++ b/test/py/tests/test_ut.py @@ -16,6 +16,7 @@ import pytest import utils # pylint: disable=E0611 from tests import fs_helper +from fs_helper import DiskHelper, FsHelper from test_android import test_abootimg def mkdir_cond(dirname): @@ -44,7 +45,6 @@ def setup_bootmenu_image(ubman): This is modelled on Armbian 22.08 Jammy """ mmc_dev = 4 - fname, mnt = fs_helper.setup_image(ubman, mmc_dev, 0x83) script = '''# DO NOT EDIT THIS FILE # @@ -120,7 +120,9 @@ booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r} # Recompile with: # mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr ''' - bootdir = os.path.join(mnt, 'boot') + fsh = FsHelper(ubman.config, 'ext4', 18, 'mmc') + fsh.setup() + bootdir = os.path.join(fsh.srcdir, 'boot') mkdir_cond(bootdir) cmd_fname = os.path.join(bootdir, 'boot.cmd') scr_fname = os.path.join(bootdir, 'boot.scr') @@ -149,13 +151,12 @@ booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r} utils.run_and_log( ubman, f'echo here {kernel} {symlink}') os.symlink(kernel, symlink) + fsh.mk_fs() + img = DiskHelper(ubman.config, mmc_dev, 'mmc') + img.add_fs(fsh, DiskHelper.EXT4) + img.create() + fsh.cleanup() - fsfile = 'ext18M.img' - utils.run_and_log(ubman, f'fallocate -l 18M {fsfile}') - utils.run_and_log(ubman, f'mkfs.ext4 {fsfile} -d {mnt}') - copy_partition(ubman, fsfile, fname) - utils.run_and_log(ubman, f'rm -rf {mnt}') - utils.run_and_log(ubman, f'rm -f {fsfile}') def setup_bootflow_image(ubman, devnum, basename, vmlinux, initrd, dtbdir, script): -- 2.43.0