summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <[email protected]>2026-04-04 08:03:06 -0600
committerTom Rini <[email protected]>2026-04-21 15:30:38 -0600
commit4e1793b1fb21e3896cf018fc35fc2c9c3e202138 (patch)
tree0c3f3294fe8427f1c78d393a956f5b5e2bc847db
parent7c69117337412d2477bc3f72e4042bca4a4e66b3 (diff)
test: fs_helper: Skip empty srcdir when creating a filesystem
FsHelper.mk_fs() always creates a srcdir via setup(), then passes it to the module-level mk_fs(). This fails for filesystem types like ext2 that do not support the -d flag, raising ValueError even when no files need to be copied. Pass None for src_dir when the srcdir is empty, so that creating an empty filesystem works for all supported types. Signed-off-by: Simon Glass <[email protected]>
-rw-r--r--test/py/tests/fs_helper.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/py/tests/fs_helper.py b/test/py/tests/fs_helper.py
index e323a97b220..ee779474ce6 100644
--- a/test/py/tests/fs_helper.py
+++ b/test/py/tests/fs_helper.py
@@ -66,8 +66,9 @@ class FsHelper:
"""Make a new filesystem and copy in the files"""
self.setup()
self._do_cleanup = True
+ src_dir = self.srcdir if os.listdir(self.srcdir) else None
self.fs_img = mk_fs(self.config, self.fs_type, self.size_mb << 20,
- self.prefix, self.srcdir, quiet=self.quiet)
+ self.prefix, src_dir, quiet=self.quiet)
def setup(self):
"""Set up the srcdir ready to receive files"""