From: Daan De Meyer Date: Mon, 17 Aug 2020 17:34:35 +0000 (+0100) Subject: CI: Add QEMU boot tests X-Git-Tag: v6~6^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F519%2Fhead;p=thirdparty%2Fmkosi.git CI: Add QEMU boot tests 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. --- diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4d46bf830..2d57c7d5b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/tests/pexpect/boot.py b/tests/pexpect/boot.py index ad2b7eed8..5a1cdaf94 100755 --- a/tests/pexpect/boot.py +++ b/tests/pexpect/boot.py @@ -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")