summaryrefslogtreecommitdiff
path: root/test/py
diff options
context:
space:
mode:
authorSimon Glass <[email protected]>2026-03-09 09:13:00 -0600
committerTom Rini <[email protected]>2026-03-23 09:18:29 -0600
commitfade4112dad0fcb4c4c5610582ef1edec8d70ddc (patch)
tree7e5baef812d5b732251979a63eee11614b0ff49f /test/py
parentc0ca147ac6228949a6d6497531c9f2f4a0dc6c67 (diff)
test: fs_helper: Allow passing the image filename
The mk_fs() function always generates its own image filename from the prefix and fs_type. Some callers need to specify a custom leaf name while still keeping the image under the persistent-data directory. Add an fs_img parameter that accepts a leaf filename. When provided, it is joined with persistent_data_dir instead of the default name. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Tom Rini <[email protected]>
Diffstat (limited to 'test/py')
-rw-r--r--test/py/tests/fs_helper.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/py/tests/fs_helper.py b/test/py/tests/fs_helper.py
index b8a22b22806..bd9169b2a4d 100644
--- a/test/py/tests/fs_helper.py
+++ b/test/py/tests/fs_helper.py
@@ -9,7 +9,8 @@ import re
import os
from subprocess import call, check_call, check_output, CalledProcessError
-def mk_fs(config, fs_type, size, prefix, src_dir=None, size_gran = 0x100000):
+def mk_fs(config, fs_type, size, prefix, src_dir=None, size_gran = 0x100000,
+ fs_img=None):
"""Create a file system volume
Args:
@@ -19,11 +20,15 @@ def mk_fs(config, fs_type, size, prefix, src_dir=None, size_gran = 0x100000):
prefix (str): Prefix string of volume's file name
src_dir (str): Root directory to use, or None for none
size_gran (int): Size granularity of file system image in bytes
+ fs_img (str or None): Leaf filename for image, or None to use a
+ default name. The image is always placed under
+ persistent_data_dir.
Raises:
CalledProcessError: if any error occurs when creating the filesystem
"""
- fs_img = f'{prefix}.{fs_type}.img'
+ if not fs_img:
+ fs_img = f'{prefix}.{fs_type}.img'
fs_img = os.path.join(config.persistent_data_dir, fs_img)
if fs_type == 'fat12':