Move setup_extlinux_image() to its own module. The image exercises the
extlinux bootmeth and is modelled on Fedora 31, so name the module and
function after what they test rather than the distribution.

Signed-off-by: Simon Glass <[email protected]>
---

Changes in v2:
- Rename the module to extlinux and the function to
  setup_extlinux_image(), naming it after the bootmeth it tests rather
  than the Fedora distribution it is modelled on

 test/py/img/extlinux.py  | 36 ++++++++++++++++++++++++++++++++++++
 test/py/tests/test_ut.py | 32 +++-----------------------------
 2 files changed, 39 insertions(+), 29 deletions(-)
 create mode 100644 test/py/img/extlinux.py

diff --git a/test/py/img/extlinux.py b/test/py/img/extlinux.py
new file mode 100644
index 00000000000..f747fc5a382
--- /dev/null
+++ b/test/py/img/extlinux.py
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
+
+"""Create extlinux test disk images"""
+
+from img.common import make_extlinux_disk
+
+
+def setup_extlinux_image(ubman, devnum, basename):
+    """Create a 20MB disk image for the extlinux bootmeth
+
+    This is modelled on Fedora 31
+
+    Args:
+        ubman (ConsoleBase): Console to use
+        devnum (int): Device number to use, e.g. 1
+        basename (str): Base name to use in the filename, e.g. 'mmc'
+    """
+    vmlinux = 'vmlinuz-5.3.7-301.fc31.armv7hl'
+    initrd = 'initramfs-5.3.7-301.fc31.armv7hl.img'
+    dtbdir = 'dtb-5.3.7-301.fc31.armv7hl'
+    script = '''# extlinux.conf generated by appliance-creator
+ui menu.c32
+menu autoboot Welcome to Fedora-Workstation-armhfp-31-1.9. Automatic boot in # 
second{,s}. Press a key for options.
+menu title Fedora-Workstation-armhfp-31-1.9 Boot Options.
+menu hidden
+timeout 20
+totaltimeout 600
+
+label Fedora-Workstation-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl)
+        kernel /%s
+        append ro root=UUID=9732b35b-4cd5-458b-9b91-80f7047e0b8a rhgb quiet 
LANG=en_US.UTF-8 cma=192MB cma=256MB
+        fdtdir /%s/
+        initrd /%s''' % (vmlinux, dtbdir, initrd)
+    make_extlinux_disk(ubman, devnum, basename, vmlinux, initrd, dtbdir,
+                       script)
diff --git a/test/py/tests/test_ut.py b/test/py/tests/test_ut.py
index 01d01e3ade7..fb3064847ff 100644
--- a/test/py/tests/test_ut.py
+++ b/test/py/tests/test_ut.py
@@ -19,7 +19,8 @@ import utils
 from tests import fs_helper
 from fs_helper import DiskHelper, FsHelper
 from test_android import test_abootimg
-from img.common import mkdir_cond, copy_partition, make_extlinux_disk
+from img.common import mkdir_cond, copy_partition
+from img.extlinux import setup_extlinux_image
 
 
 def setup_bootmenu_image(ubman):
@@ -141,33 +142,6 @@ booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
     fsh.cleanup()
 
 
-def setup_fedora_image(ubman, devnum, basename):
-    """Create a 20MB Fedora disk image with a single FAT partition
-
-    Args:
-        ubman (ConsoleBase): Console to use
-        devnum (int): Device number to use, e.g. 1
-        basename (str): Base name to use in the filename, e.g. 'mmc'
-    """
-    vmlinux = 'vmlinuz-5.3.7-301.fc31.armv7hl'
-    initrd = 'initramfs-5.3.7-301.fc31.armv7hl.img'
-    dtbdir = 'dtb-5.3.7-301.fc31.armv7hl'
-    script = '''# extlinux.conf generated by appliance-creator
-ui menu.c32
-menu autoboot Welcome to Fedora-Workstation-armhfp-31-1.9. Automatic boot in # 
second{,s}. Press a key for options.
-menu title Fedora-Workstation-armhfp-31-1.9 Boot Options.
-menu hidden
-timeout 20
-totaltimeout 600
-
-label Fedora-Workstation-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl)
-        kernel /%s
-        append ro root=UUID=9732b35b-4cd5-458b-9b91-80f7047e0b8a rhgb quiet 
LANG=en_US.UTF-8 cma=192MB cma=256MB
-        fdtdir /%s/
-        initrd /%s''' % (vmlinux, dtbdir, initrd)
-    make_extlinux_disk(ubman, devnum, basename, vmlinux, initrd, dtbdir,
-                       script)
-
 def setup_cros_image(ubman):
     """Create a 20MB disk image with ChromiumOS partitions"""
     Partition = collections.namedtuple('part', 'start,size,name')
@@ -548,7 +522,7 @@ def setup_rauc_image(ubman):
 def test_ut_dm_init_bootstd(ubman):
     """Initialise data for bootflow tests"""
 
-    setup_fedora_image(ubman, 1, 'mmc')
+    setup_extlinux_image(ubman, 1, 'mmc')
     setup_bootmenu_image(ubman)
     setup_cedit_file(ubman)
     setup_cros_image(ubman)
-- 
2.43.0

Reply via email to