]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
CI: Add QEMU boot tests 519/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 17 Aug 2020 17:34:35 +0000 (18:34 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 25 Aug 2020 07:35:06 +0000 (08:35 +0100)
Adding these gives us a clear idea of which setups should work and which
are broken. This helps with triaging issues since we can immediately see
if a setup is supposed to work or not. It also makes sure setups that do
work keep working in the future.

Currently, only Arch, CentOS and Fedora can boot on all included setups
(nspawn, UEFI + systemd-boot with unified kernel images, UEFI +
systemd-boot and BIOS). Debian, Ubuntu, OpenSUSE and Mageia fail
on UEFI without unified kernel images because their package managers
don't install any boot loader entries that systemd-boot can read.

Photon doesn't work on any of the setups. Clear also has a lot of issues
due to it using its own bootloader and OpenMandriva has QEMU failures.
For now, we disable all these but we hope support by them can be added
by interested contributors in the future.

.github/workflows/ci.yml
tests/pexpect/boot.py

index 4d46bf830ecd40b2ba6c281aa1dbcd814c8cd904..2d57c7d5ba39e7fd0df88484573a75ff48727128 100644 (file)
@@ -55,10 +55,14 @@ jobs:
     - name: Install
       run: sudo apt-get update && sudo apt-get install --no-install-recommends
         debootstrap
+        ovmf
         python3-pexpect
+        qemu-system-x86-64
         systemd-container
 
     - name: Build ${{ matrix.distro }}/${{ matrix.format }}
+      if: matrix.format != 'tar' &&
+          matrix.distro != 'photon'
       run: |
         tee mkosi.default << EOF
         [Distribution]
@@ -68,35 +72,125 @@ jobs:
         Format=${{ matrix.format }}
 
         [Validation]
-        # Set to empty password if we ever get opensuse to work with empty root password.
-        # See https://github.com/systemd/mkosi/pull/514.
-        Password=root
+        Password=
         EOF
 
         sudo python3 -m mkosi build
 
     - name: Boot ${{ matrix.distro }}/${{ matrix.format }}
       # photon boot gets stuck on systemd-networkd-wait-online. See https://github.com/systemd/mkosi/pull/514.
-      if: matrix.format != 'tar' && matrix.distro != 'photon'
+      if: matrix.format != 'tar' &&
+          matrix.distro != 'photon'
       run: sudo ./tests/pexpect/boot.py python3 -m mkosi boot
 
+    - name: Build ${{ matrix.distro }}/${{ matrix.format }} UEFI UKI
+      if: matrix.format != 'directory' &&
+          matrix.format != 'plain_squashfs' &&
+          matrix.format != 'tar' &&
+          matrix.distro != 'clear' &&
+          matrix.distro != 'openmandriva' &&
+          matrix.distro != 'photon'
+      run: |
+        tee mkosi.default << EOF
+        [Distribution]
+        Distribution=${{ matrix.distro }}
+
+        [Output]
+        Format=${{ matrix.format }}
+        Bootable=yes
+        BootProtocols=uefi
+
+        [Validation]
+        Password=
+
+        [Host]
+        QemuHeadless=yes
+        EOF
+
+        sudo python3 -m mkosi --force build
+
+    - name: Boot ${{ matrix.distro }}/${{ matrix.format }} UEFI UKI
+      if: matrix.format != 'directory' &&
+          matrix.format != 'plain_squashfs' &&
+          matrix.format != 'gpt_squashfs' &&
+          matrix.format != 'tar' &&
+          matrix.distro != 'clear' &&
+          matrix.distro != 'openmandriva' &&
+          matrix.distro != 'photon' &&
+          !(matrix.distro == 'ubuntu' && matrix.format == 'gpt_squashfs')
+      run: sudo ./tests/pexpect/boot.py python3 -m mkosi qemu
+
     - name: Build ${{ matrix.distro }}/${{ matrix.format }} UEFI
-      if: matrix.format != 'directory' && matrix.format != 'tar' && matrix.format != 'plain_squashfs' &&
-          (matrix.distro != 'clear' || matrix.format != 'gpt_squashfs') && matrix.distro != 'photon'
-      run: sudo python3 -m mkosi
-            --debug run
-            --distribution ${{ matrix.distro }}
-            --format ${{ matrix.format }}
-            --bootable
-            --boot-protocols uefi
-            --force
+      if: matrix.format != 'directory' &&
+          matrix.format != 'plain_squashfs' &&
+          matrix.format != 'tar' && (
+          matrix.distro == 'arch' ||
+          matrix.distro == 'centos' ||
+          matrix.distro == 'fedora')
+      run: |
+        tee mkosi.default << EOF
+        [Distribution]
+        Distribution=${{ matrix.distro }}
+
+        [Output]
+        Format=${{ matrix.format }}
+        Bootable=yes
+        BootProtocols=uefi
+        WithUnifiedKernelImages=no
+        # Boot with systemd.volatile=overlay so squashfs images can write to the filesystem
+        KernelCommandLine=systemd.volatile=overlay
+
+        [Validation]
+        Password=
+
+        [Host]
+        QemuHeadless=yes
+        EOF
+
+        sudo python3 -m mkosi --force build
+
+    - name: Boot ${{ matrix.distro }}/${{ matrix.format }} UEFI
+      if: matrix.format != 'directory' &&
+          matrix.format != 'plain_squashfs' &&
+          matrix.format != 'tar' && (
+          matrix.distro == 'arch' ||
+          matrix.distro == 'centos' ||
+          matrix.distro == 'fedora')
+      run: sudo ./tests/pexpect/boot.py python3 -m mkosi qemu
 
     - name: Build ${{ matrix.distro }}/${{ matrix.format }} BIOS
-      if: matrix.format != 'directory' && matrix.format != 'tar' && !contains(matrix.format, 'squashfs')
-      run: sudo python3 -m mkosi
-            --debug run
-            --distribution ${{ matrix.distro }}
-            --format ${{ matrix.format }}
-            --bootable
-            --boot-protocols bios
-            --force
+      if: matrix.format != 'directory' &&
+          matrix.format != 'gpt_squashfs' &&
+          matrix.format != 'plain_squashfs' &&
+          matrix.format != 'tar' && (
+          matrix.distro == 'arch' ||
+          matrix.distro == 'centos' ||
+          matrix.distro == 'fedora')
+      run: |
+        tee mkosi.default << EOF
+        [Distribution]
+        Distribution=${{ matrix.distro }}
+
+        [Output]
+        Format=${{ matrix.format }}
+        Bootable=yes
+        BootProtocols=bios
+
+        [Validation]
+        Password=
+
+        [Host]
+        QemuHeadless=yes
+        EOF
+
+        sudo python3 -m mkosi --force build
+
+    - name: Boot ${{ matrix.distro }}/${{ matrix.format }} BIOS
+      if: matrix.format != 'directory' &&
+          matrix.format != 'gpt_squashfs' &&
+          matrix.format != 'plain_squashfs' &&
+          matrix.format != 'tar' && (
+          matrix.distro == 'arch' ||
+          matrix.distro == 'centos' ||
+          matrix.distro == 'fedora')
+      run: sudo ./tests/pexpect/boot.py python3 -m mkosi qemu
index ad2b7eed85fcf5a241aa90faf9ace1784d5dce2c..5a1cdaf948247e354938bfce9cf6e47a41c9d913 100755 (executable)
@@ -5,14 +5,11 @@ import sys
 
 
 def run() -> None:
-    p = pexpect.spawnu(" ".join(sys.argv[1:]), logfile=sys.stdout, timeout=45)
+    p = pexpect.spawnu(" ".join(sys.argv[1:]), logfile=sys.stdout, timeout=240)
 
     p.expect("login:")
     p.sendline("root")
 
-    p.expect("Password:")
-    p.sendline("root")
-
     p.expect("#")
     p.sendline("systemctl poweroff")