[PATCH v2 11/11] test: Move disk images to persistent-data directory

Mattijs Korpershoek mkorpershoek at kernel.org
Mon Jun 8 10:49:51 CEST 2026


Hi Simon,

Thank you for the patch.

On Sat, May 23, 2026 at 02:54, Simon Glass <sjg at chromium.org> wrote:

> It is annoying to have disk images in the source directory since it
> clutters up the working space.
>
> Remove cur_dir=True from DiskHelper calls so disk images are written to
> the persistent-data directory instead.
>
> Move scsi.img too (used by the bootstd tests) and mmc6.img (used by the
> MBR tests).
>
> Add a few comments as to where the images are used.
>
> This keeps the source tree clean and puts disk images in the same place
> as other test data.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>

I've re-ran the following using this series:
$ git clean -xdf
$ python3 -m venv venv && . venv/bin/activate && pip install -r test/py/requirements.txt && pip install setuptools && ./test/py/test.py --bd sandbox --build -k ut

Then, if I check the source folder, I still see some disk images:
$ ls *.img
mmc10.img  mmc1.img  mmc5.img  mmc7.img  mmc8.img  mmc9.img

Also see:

$ find -name '*.img'
./build-sandbox/persistent-data/test_efi_capsule.vfat.img
./build-sandbox/persistent-data/scsi.img
./build-sandbox/persistent-data/2MB.ext2.img
./build-sandbox/persistent-data/1MB.fat32.img
./build-sandbox/persistent-data/mmc6.img
./build-sandbox/persistent-data/mmc.vfat.tmp/initramfs-5.3.7-301.fc31.armv7hl.img
./build-sandbox/persistent-data/mmc1.img
./build-sandbox/persistent-data/mmc4.img
./build-sandbox/persistent-data/bootv4.img
./build-sandbox/persistent-data/vendor_boot.img
./build-sandbox/persistent-data/boot.img
./build-sandbox/persistent-data/flash1.img
./build-sandbox/bootv4.img
./build-sandbox/vendor_boot.img
./build-sandbox/boot.img
./mmc1.img
./mmc9.img
./mmc5.img
./mmc7.img
./mmc8.img
./mmc10.img

Is there a reason for not moving all the images?

I think that for this patch, we should at least ensure that all the
mmc*.img are moved.

For example, mmc7.img and mmc8.img are used by Android and I believe
they should be in build-sandbox/persistent-data/ as well.

> ---
>
> (no changes since v1)
>
>  test/py/img/common.py    |  2 +-
>  test/py/img/efi.py       |  2 +-
>  test/py/img/script.py    |  2 +-
>  test/py/tests/test_ut.py | 11 +++++++----
>  4 files changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/test/py/img/common.py b/test/py/img/common.py
> index 301b6c840d4..a2c86c5c282 100644
> --- a/test/py/img/common.py
> +++ b/test/py/img/common.py
> @@ -74,7 +74,7 @@ def make_extlinux_disk(ubman, devnum, basename, vmlinux, initrd, dtbdir,
>  
>      fsh.mk_fs()
>  
> -    img = DiskHelper(ubman.config, devnum, basename, True)
> +    img = DiskHelper(ubman.config, devnum, basename)
>      img.add_fs(fsh, DiskHelper.VFAT, bootable=True)
>  
>      ext4 = FsHelper(ubman.config, 'ext4', 1, prefix=basename)
> diff --git a/test/py/img/efi.py b/test/py/img/efi.py
> index 4cb0bb95a59..06fda8a90b2 100644
> --- a/test/py/img/efi.py
> +++ b/test/py/img/efi.py
> @@ -31,7 +31,7 @@ def setup_efi_image(ubman):
>  
>      fsh.mk_fs()
>  
> -    img = DiskHelper(ubman.config, devnum, 'flash', True)
> +    img = DiskHelper(ubman.config, devnum, 'flash')
>      img.add_fs(fsh, DiskHelper.VFAT)
>      img.create()
>      fsh.cleanup()
> diff --git a/test/py/img/script.py b/test/py/img/script.py
> index e6072bf5bd9..5c0c9e99183 100644
> --- a/test/py/img/script.py
> +++ b/test/py/img/script.py
> @@ -126,7 +126,7 @@ booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
>          ubman, f'echo here {kernel} {symlink}')
>      os.symlink(kernel, symlink)
>      fsh.mk_fs()
> -    img = DiskHelper(ubman.config, mmc_dev, 'mmc', True)
> +    img = DiskHelper(ubman.config, mmc_dev, 'mmc')
>      img.add_fs(fsh, DiskHelper.EXT4)
>      img.create()
>      fsh.cleanup()
> diff --git a/test/py/tests/test_ut.py b/test/py/tests/test_ut.py
> index 38fec6cf8a2..9c938943259 100644
> --- a/test/py/tests/test_ut.py
> +++ b/test/py/tests/test_ut.py
> @@ -32,7 +32,8 @@ from img.cedit import setup_cedit_file
>  def test_ut_dm_init(ubman):
>      """Initialize data for ut dm tests."""
>  
> -    fn = ubman.config.source_dir + '/testflash.bin'
> +    # This is used by flash-stick at 0 in test.py
> +    fn = ubman.config.persistent_data_dir + '/testflash.bin'
>      if not os.path.exists(fn):
>          data = b'this is a test'
>          data += b'\x00' * ((4 * 1024 * 1024) - len(data))
> @@ -45,8 +46,8 @@ def test_ut_dm_init(ubman):
>          with open(fn, 'wb') as fh:
>              fh.write(data)
>  
> -    # Create a file with a single partition
> -    fn = ubman.config.source_dir + '/scsi.img'
> +    # Create a file with a single partition (used by /scsi in test.dts) */
> +    fn = ubman.config.persistent_data_dir + '/scsi.img'
>      if not os.path.exists(fn):
>          data = b'\x00' * (2 * 1024 * 1024)
>          with open(fn, 'wb') as fh:
> @@ -54,11 +55,13 @@ def test_ut_dm_init(ubman):
>          utils.run_and_log(
>              ubman, f'sfdisk {fn}', stdin=b'type=83')
>  
> +    # These two are used by test/dm/host.c
>      FsHelper(ubman.config, 'ext2', 2, '2MB').mk_fs()
>      FsHelper(ubman.config, 'fat32', 1, '1MB').mk_fs()
>  
> +    # This is used by test/cmd/mbr.c
>      mmc_dev = 6
> -    fn = os.path.join(ubman.config.source_dir, f'mmc{mmc_dev}.img')
> +    fn = os.path.join(ubman.config.persistent_data_dir, f'mmc{mmc_dev}.img')
>      data = b'\x00' * (12 * 1024 * 1024)
>      with open(fn, 'wb') as fh:
>          fh.write(data)
> -- 
> 2.43.0


More information about the U-Boot mailing list