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 <[email protected]>
---

(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@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

Reply via email to