[PATCH 10/14] test: Convert setup_efi_image() to use FsHelper
Simon Glass
sjg at chromium.org
Sat Apr 4 16:03:14 CEST 2026
Simplify this test-setup code by using the helper.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
test/py/tests/test_ut.py | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/test/py/tests/test_ut.py b/test/py/tests/test_ut.py
index 8bc915ee5e0..ad84fb56b85 100644
--- a/test/py/tests/test_ut.py
+++ b/test/py/tests/test_ut.py
@@ -561,11 +561,9 @@ def test_ut_dm_init(ubman):
def setup_efi_image(ubman):
"""Create a 20MB disk image with an EFI app on it"""
devnum = 1
- basename = 'flash'
- fname, mnt = fs_helper.setup_image(ubman, devnum, 0xc, second_part=True,
- basename=basename)
-
- efi_dir = os.path.join(mnt, 'EFI')
+ fsh = FsHelper(ubman.config, 'vfat', 18, 'flash')
+ fsh.setup()
+ efi_dir = os.path.join(fsh.srcdir, 'EFI')
mkdir_cond(efi_dir)
bootdir = os.path.join(efi_dir, 'BOOT')
mkdir_cond(bootdir)
@@ -575,13 +573,14 @@ def setup_efi_image(ubman):
with open(efi_src, 'rb') as inf:
with open(efi_dst, 'wb') as outf:
outf.write(inf.read())
- fsfile = 'vfat18M.img'
- utils.run_and_log(ubman, f'fallocate -l 18M {fsfile}')
- utils.run_and_log(ubman, f'mkfs.vfat {fsfile}')
- utils.run_and_log(ubman, ['sh', '-c', f'mcopy -vs -i {fsfile} {mnt}/* ::/'])
- copy_partition(ubman, fsfile, fname)
- utils.run_and_log(ubman, f'rm -rf {mnt}')
- utils.run_and_log(ubman, f'rm -f {fsfile}')
+
+ fsh.mk_fs()
+
+ img = DiskHelper(ubman.config, devnum, 'flash', True)
+ img.add_fs(fsh, DiskHelper.VFAT)
+ img.create()
+ fsh.cleanup()
+
def setup_rauc_image(ubman):
"""Create a 40MB disk image with an A/B RAUC system on it"""
--
2.43.0
More information about the U-Boot
mailing list