summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <[email protected]>2026-04-04 08:03:14 -0600
committerTom Rini <[email protected]>2026-04-21 15:30:38 -0600
commit22ff15d191c0196cd87678a57e45e7525313770b (patch)
treee3d9fa87e0194f2b8d0624a7802fbb8cd27f36e5
parente7c46fc967fc2f180393a4e42f7c338311330c1e (diff)
test: Convert setup_efi_image() to use FsHelper
Simplify this test-setup code by using the helper. Signed-off-by: Simon Glass <[email protected]>
-rw-r--r--test/py/tests/test_ut.py23
1 files 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"""