diff options
author | Simon Glass <sjg@chromium.org> | 2024-11-21 15:32:09 -0700 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-11-26 11:13:39 -0600 |
commit | fde4e53aaa7032538b7f583829dcc436ce2d55a4 (patch) | |
tree | a32f795d9b23bf76380dd53f88980c380a8fbc2d /test/py/tests/test_ut.py | |
parent | c25e8ceea45038ce6a1cf6d00904059e493961ee (diff) |
test_ut: Add an image size to setup_image()
Add a parameter to indicate the size of the image to build.
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'test/py/tests/test_ut.py')
-rw-r--r-- | test/py/tests/test_ut.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/test/py/tests/test_ut.py b/test/py/tests/test_ut.py index 940373c4ab3..647e424d6fb 100644 --- a/test/py/tests/test_ut.py +++ b/test/py/tests/test_ut.py @@ -28,13 +28,15 @@ def mkdir_cond(dirname): if not os.path.exists(dirname): os.mkdir(dirname) -def setup_image(cons, devnum, part_type, second_part=False, basename='mmc'): - """Create a 20MB disk image with a single partition +def setup_image(cons, devnum, part_type, img_size=20, second_part=False, + basename='mmc'): + """Create a disk image with a single partition Args: cons (ConsoleBase): Console to use devnum (int): Device number to use, e.g. 1 part_type (int): Partition type, e.g. 0xc for FAT32 + img_size (int): Image size in MiB second_part (bool): True to contain a small second partition basename (str): Base name to use in the filename, e.g. 'mmc' @@ -47,11 +49,11 @@ def setup_image(cons, devnum, part_type, second_part=False, basename='mmc'): mnt = os.path.join(cons.config.persistent_data_dir, 'mnt') mkdir_cond(mnt) - spec = f'type={part_type:x}, size=18M, bootable' + spec = f'type={part_type:x}, size={img_size - 2}M, start=1M, bootable' if second_part: spec += '\ntype=c' - u_boot_utils.run_and_log(cons, f'qemu-img create {fname} 20M') + u_boot_utils.run_and_log(cons, f'qemu-img create {fname} {img_size}M') u_boot_utils.run_and_log(cons, f'sudo sfdisk {fname}', stdin=spec.encode('utf-8')) return fname, mnt |