[PATCH 1/1] test: fit: Use shared make_fname from fit_util

Aristo Chen aristo.chen at canonical.com
Mon Apr 20 09:48:05 CEST 2026


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 at canonical.com>
---
 test/py/tests/test_fit.py | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/test/py/tests/test_fit.py b/test/py/tests/test_fit.py
index 619f73153a0..3b60f814c85 100755
--- a/test/py/tests/test_fit.py
+++ b/test/py/tests/test_fit.py
@@ -119,16 +119,6 @@ host save hostfs 0 %(loadables2_addr)x %(loadables2_out)s %(loadables2_size)x
 @pytest.mark.buildconfigspec('fit_signature')
 @pytest.mark.requiredtool('dtc')
 def test_fit(ubman):
-    def make_fname(leaf):
-        """Make a temporary filename
-
-        Args:
-            leaf: Leaf name of file to create (within temporary directory)
-        Return:
-            Temporary filename
-        """
-        return os.path.join(ubman.config.build_dir, leaf)
-
     def filesize(fname):
         """Get the size of a file
 
@@ -156,7 +146,7 @@ def test_fit(ubman):
         Returns:
             Filename of ramdisk created
         """
-        fname = make_fname(filename)
+        fname = fit_util.make_fname(ubman, filename)
         data = ''
         for i in range(100):
             data += '%s %d was seldom used in the middle ages\n' % (text, i)
@@ -265,12 +255,12 @@ def test_fit(ubman):
         ramdisk = make_ramdisk('test-ramdisk.bin', 'ramdisk')
         loadables1 = fit_util.make_kernel(ubman, 'test-loadables1.bin', 'lenrek')
         loadables2 = make_ramdisk('test-loadables2.bin', 'ksidmar')
-        kernel_out = make_fname('kernel-out.bin')
-        fdt = make_fname('u-boot.dtb')
-        fdt_out = make_fname('fdt-out.dtb')
-        ramdisk_out = make_fname('ramdisk-out.bin')
-        loadables1_out = make_fname('loadables1-out.bin')
-        loadables2_out = make_fname('loadables2-out.bin')
+        kernel_out = fit_util.make_fname(ubman, 'kernel-out.bin')
+        fdt = fit_util.make_fname(ubman, 'u-boot.dtb')
+        fdt_out = fit_util.make_fname(ubman, 'fdt-out.dtb')
+        ramdisk_out = fit_util.make_fname(ubman, 'ramdisk-out.bin')
+        loadables1_out = fit_util.make_fname(ubman, 'loadables1-out.bin')
+        loadables2_out = fit_util.make_fname(ubman, 'loadables2-out.bin')
 
         # Set up basic parameters with default values
         params = {
-- 
2.43.0



More information about the U-Boot mailing list