[Concept,15/16] test: distro: Add end-to-end test for ubuntu-iso-to-uboot

Message ID 20260421183511.2044469-16-sjg@u-boot.org
State New
Headers
Series efi-x86: Boot Ubuntu live ISOs via U-Boot + BLS, end to end |

Commit Message

Simon Glass April 21, 2026, 6:34 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

Cover the ubuntu-iso-to-uboot.py helper end to end: rewrite an Ubuntu
live ISO, boot the result in qemu through U-Boot + BLS, and wait for
systemd to start gdm.service on ttyS0. This exercises the script, the
isofs streaming read path, XBOOTLDR recognition and the BLS-target scan
introduced earlier in the series.

The rewrite itself is driven by the labgrid UBootWriterDriver's new
'qemu-efi-iso' method, which runs the script before QEMU is started and
caches its output by mtime. The new 'efi-x86_64-uboot-iso' role must
be configured with source_disk=ubuntu, disk=ubuntu-uboot and a path to
the script; on any other lab the role is absent and the test is
deselected by its role marker.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 test/py/tests/test_distro.py | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
  

Patch

diff --git a/test/py/tests/test_distro.py b/test/py/tests/test_distro.py
index 0a0ab8269cc..ed3f6d86249 100644
--- a/test/py/tests/test_distro.py
+++ b/test/py/tests/test_distro.py
@@ -99,6 +99,39 @@  def test_distro_arm_app_extlinux(ubman):
 
     ubman.restart_uboot()
 
+@pytest.mark.boardspec('efi-x86_app64')
+@pytest.mark.role('efi-x86_64-uboot-iso')
+@pytest.mark.restart
+def test_distro_ubuntu_iso_uboot(ubman):
+    """Boot a rewritten Ubuntu live ISO through U-Boot + BLS.
+
+    The 'efi-x86_64-uboot-iso' role's UBootWriterDriver uses the
+    'qemu-efi-iso' method, which runs scripts/ubuntu-iso-to-uboot.py
+    to rebuild the destination ISO (image slot 'ubuntu-uboot') from
+    the source (slot 'ubuntu') before QEMU boots. U-Boot's
+    BOOTMETH_BLS then picks up /loader/entry.conf and loads the
+    casper kernel/initrd straight off the ISO 9660 partition.
+    """
+    with ubman.log.section('boot'):
+        # The efi_media_0 phantom bootdev OVMF exposes makes bootflow
+        # scan iterate through many dead probes before reaching the
+        # ISO's real partition, so allow a generous timeout for the
+        # first BLS match.
+        with ubman.temporary_timeout(120 * 1000):
+            ubman.run_command('boot', wait_for_prompt=False)
+            ubman.expect([r"Booting bootflow '[^']+' with bls"])
+
+    # The ISO's cmdline carries 'quiet splash' so kernel-level info
+    # messages (including systemd-journald's kmsg output) are dropped;
+    # what does reach ttyS0 is systemd-pid1's own '[  OK  ]' status
+    # writer. gdm.service is the latest reliable "userspace fully up"
+    # marker before casper's snap-run race loop fills the console.
+    with ubman.log.section('Ubuntu'):
+        with ubman.temporary_timeout(120 * 1000):
+            ubman.expect([r'Started gdm\.service'])
+
+    ubman.restart_uboot()
+
 @pytest.mark.boardspec('efi-arm_app64')
 @pytest.mark.role('efi-aarch64')
 @pytest.mark.restart