test: Write the SPI image to the persistent-data directory

It is annoying to have disk images in the source directory since it
clutters up the working space.

Move spi.bin (used by the SPI tests) into the persistent-data
directory, update the driver and add a comment.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
This commit is contained in:
Simon Glass
2025-12-28 20:46:30 -07:00
committed by Simon Glass
parent 3f133727bf
commit 0f1d14835b
3 changed files with 15 additions and 5 deletions

View File

@@ -27,10 +27,12 @@ static int dm_test_spi_flash(struct unit_test_state *uts)
uint map_size;
ulong map_base;
uint offset;
char pathname[256];
int i;
src = map_sysmem(0x20000, full_size);
ut_assertok(os_write_file("spi.bin", src, full_size));
ut_assertok(os_persistent_file(pathname, sizeof(pathname), "spi.bin"));
ut_assertok(os_write_file(pathname, src, full_size));
ut_assertok(uclass_first_device_err(UCLASS_SPI_FLASH, &dev));
dst = map_sysmem(0x20000 + full_size, full_size);

View File

@@ -42,7 +42,7 @@ def test_ut_dm_init(ubman):
with open(fn, 'wb') as fh:
fh.write(data)
fn = ubman.config.source_dir + '/spi.bin'
fn = ubman.config.persistent_data_dir + '/spi.bin'
if not os.path.exists(fn):
data = b'\x00' * (2 * 1024 * 1024)
with open(fn, 'wb') as fh: