There are two issues with this function currently. One is that while we can be passed an image size to use, we always called qemu-img with 20M as the size. Fix this by using the size parameter. The second issue is that reserving 2MiB at the end is not enough room to add a GPT (and the backup GPT that goes on the end) so reserve 4MiB off the end and make all of the existing callers use 16M rather than 18M.
Signed-off-by: Tom Rini <tr...@konsulko.com> --- Cc: Simon Glass <s...@chromium.org> --- test/py/tests/fs_helper.py | 4 ++-- test/py/tests/test_ut.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/py/tests/fs_helper.py b/test/py/tests/fs_helper.py index 512ec9c04b06..7ed8af47aa4a 100644 --- a/test/py/tests/fs_helper.py +++ b/test/py/tests/fs_helper.py @@ -89,13 +89,13 @@ def setup_image(config, devnum, part_type, img_size=20, second_part=False, fname = os.path.join(config.source_dir, f'{basename}{devnum}.img') mnt = os.path.join(config.persistent_data_dir, 'scratch') - spec = f'type={part_type:x}, size={img_size - 2}M, start=1M, bootable' + spec = f'type={part_type:x}, size={img_size - 4}M, start=1M, bootable' if second_part: spec += '\ntype=c' try: check_call(f'mkdir -p {mnt}', shell=True) - check_call(f'qemu-img create {fname} 20M', shell=True) + check_call(f'qemu-img create {fname} {img_size}M', shell=True) check_call(f'printf "{spec}" | sfdisk {fname}', shell=True) except CalledProcessError: call(f'rm -f {fname}', shell=True) diff --git a/test/py/tests/test_ut.py b/test/py/tests/test_ut.py index cec894a7b9e3..1e7ed09cebb6 100644 --- a/test/py/tests/test_ut.py +++ b/test/py/tests/test_ut.py @@ -139,8 +139,8 @@ booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r} cons, f'echo here {kernel} {symlink}') os.symlink(kernel, symlink) - fsfile = 'ext18M.img' - u_boot_utils.run_and_log(cons, f'fallocate -l 18M {fsfile}') + fsfile = 'ext16M.img' + u_boot_utils.run_and_log(cons, f'fallocate -l 16M {fsfile}') u_boot_utils.run_and_log(cons, f'mkfs.ext4 {fsfile} -d {mnt}') u_boot_utils.run_and_log(cons, f'dd if={fsfile} of={fname} bs=1M seek=1') u_boot_utils.run_and_log(cons, f'rm -rf {mnt}') @@ -191,8 +191,8 @@ label Fedora-Workstation-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl) u_boot_utils.run_and_log( cons, f'dtc -o {dtb_file}', stdin=b'/dts-v1/; / {};') - fsfile = 'vfat18M.img' - u_boot_utils.run_and_log(cons, f'fallocate -l 18M {fsfile}') + fsfile = 'vfat16M.img' + u_boot_utils.run_and_log(cons, f'fallocate -l 16M {fsfile}') u_boot_utils.run_and_log(cons, f'mkfs.vfat {fsfile}') u_boot_utils.run_and_log(cons, ['sh', '-c', f'mcopy -i {fsfile} {mnt}/* ::/']) u_boot_utils.run_and_log(cons, f'dd if={fsfile} of={fname} bs=1M seek=1') @@ -529,8 +529,8 @@ def setup_efi_image(cons): with open(efi_src, 'rb') as inf: with open(efi_dst, 'wb') as outf: outf.write(inf.read()) - fsfile = 'vfat18M.img' - u_boot_utils.run_and_log(cons, f'fallocate -l 18M {fsfile}') + fsfile = 'vfat16M.img' + u_boot_utils.run_and_log(cons, f'fallocate -l 16M {fsfile}') u_boot_utils.run_and_log(cons, f'mkfs.vfat {fsfile}') u_boot_utils.run_and_log(cons, ['sh', '-c', f'mcopy -vs -i {fsfile} {mnt}/* ::/']) u_boot_utils.run_and_log(cons, f'dd if={fsfile} of={fname} bs=1M seek=1') -- 2.43.0