]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
test: fs_helper: Skip empty srcdir when creating a filesystem
authorSimon Glass <sjg@chromium.org>
Sat, 4 Apr 2026 14:03:06 +0000 (08:03 -0600)
committerTom Rini <trini@konsulko.com>
Tue, 21 Apr 2026 21:30:38 +0000 (15:30 -0600)
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 <sjg@chromium.org>
test/py/tests/fs_helper.py

index e323a97b22064847e11aa95bbde4ee2c696e875c..ee779474ce60eb2660eb5b830c6cd85049299ea0 100644 (file)
@@ -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"""