]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
test: fit: Use shared make_fname from fit_util
authorAristo Chen <aristo.chen@canonical.com>
Fri, 1 May 2026 05:51:04 +0000 (05:51 +0000)
committerTom Rini <trini@konsulko.com>
Fri, 8 May 2026 21:49:27 +0000 (15:49 -0600)
test_fit.py declares a local make_fname closure that is byte-identical
to fit_util.make_fname. Drop the local copy and call the shared helper
at all seven call sites so there is one definition to maintain.

No behavioural change. Both implementations return
os.path.join(ubman.config.build_dir, basename).

Signed-off-by: Aristo Chen <aristo.chen@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
test/py/tests/test_fit.py

index bcaaa6a5fc416d28065ef8a522c1a2613a3fb35b..4f56a1421e19dd2026160a5a5bb9203f896c9d14 100755 (executable)
@@ -140,18 +140,6 @@ class TestFitImage:
       - run code coverage to make sure we are testing all the code
     """
 
-    def make_fname(self, ubman, leaf):
-        """Make a temporary filename
-
-        Args:
-            ubman (ConsoleBase): U-Boot fixture
-            leaf (str): Leaf name of file to create (within temporary directory)
-
-        Return:
-            str: Temporary filename
-        """
-        return os.path.join(ubman.config.build_dir, leaf)
-
     def filesize(self, fname):
         """Get the size of a file
 
@@ -181,7 +169,7 @@ class TestFitImage:
         Returns:
             str: Filename of ramdisk created
         """
-        fname = self.make_fname(ubman, filename)
+        fname = fit_util.make_fname(ubman, filename)
         data = ''
         for i in range(100):
             data += f'{text} {i} was seldom used in the middle ages\n'
@@ -278,33 +266,33 @@ class TestFitImage:
             'fit_addr' : 0x1000,
 
             'kernel' : kernel,
-            'kernel_out' : self.make_fname(ubman, 'kernel-out.bin'),
+            'kernel_out' : fit_util.make_fname(ubman, 'kernel-out.bin'),
             'kernel_addr' : 0x40000,
             'kernel_size' : self.filesize(kernel),
             'kernel_config' : 'kernel = "kernel-1";',
 
             'fdt_data' : fdt_data,
-            'fdt' : self.make_fname(ubman, 'u-boot.dtb'),
-            'fdt_out' : self.make_fname(ubman, 'fdt-out.dtb'),
+            'fdt' : fit_util.make_fname(ubman, 'u-boot.dtb'),
+            'fdt_out' : fit_util.make_fname(ubman, 'fdt-out.dtb'),
             'fdt_addr' : 0x80000,
             'fdt_size' : self.filesize(fdt_data),
             'fdt_load' : '',
 
             'ramdisk' : ramdisk,
-            'ramdisk_out' : self.make_fname(ubman, 'ramdisk-out.bin'),
+            'ramdisk_out' : fit_util.make_fname(ubman, 'ramdisk-out.bin'),
             'ramdisk_addr' : 0xc0000,
             'ramdisk_size' : self.filesize(ramdisk),
             'ramdisk_load' : '',
             'ramdisk_config' : '',
 
             'loadables1' : loadables1,
-            'loadables1_out' : self.make_fname(ubman, 'loadables1-out.bin'),
+            'loadables1_out' : fit_util.make_fname(ubman, 'loadables1-out.bin'),
             'loadables1_addr' : 0x100000,
             'loadables1_size' : self.filesize(loadables1),
             'loadables1_load' : '',
 
             'loadables2' : loadables2,
-            'loadables2_out' : self.make_fname(ubman, 'loadables2-out.bin'),
+            'loadables2_out' : fit_util.make_fname(ubman, 'loadables2-out.bin'),
             'loadables2_addr' : 0x140000,
             'loadables2_size' : self.filesize(loadables2),
             'loadables2_load' : '',