From 51b492074674d020de1d556dc2c3fa224b41e508 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Thu, 27 Mar 2025 14:24:28 +0100 Subject: [PATCH] test: Boot integration test VMs without an initrd if possible If we don't need an initrd, let's not waste time in one. We have to gate this by distributions that have the necessary kernel modules to make this work as builtin modules, hopefully we can expand the list in the future. --- .../TEST-08-INITRD/meson.build | 1 + .../TEST-24-CRYPTSETUP/meson.build | 1 + .../integration-test-wrapper.py | 22 ++++++++++++++----- test/integration-tests/meson.build | 2 +- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/test/integration-tests/TEST-08-INITRD/meson.build b/test/integration-tests/TEST-08-INITRD/meson.build index dcbfe20134..5425096a56 100644 --- a/test/integration-tests/TEST-08-INITRD/meson.build +++ b/test/integration-tests/TEST-08-INITRD/meson.build @@ -8,5 +8,6 @@ integration_tests += [ ], 'exit-code' : 124, 'vm' : true, + 'firmware' : 'linux', }, ] diff --git a/test/integration-tests/TEST-24-CRYPTSETUP/meson.build b/test/integration-tests/TEST-24-CRYPTSETUP/meson.build index 4d65e1d9ab..c9e0271e96 100644 --- a/test/integration-tests/TEST-24-CRYPTSETUP/meson.build +++ b/test/integration-tests/TEST-24-CRYPTSETUP/meson.build @@ -22,5 +22,6 @@ integration_tests += [ '--runtime-size=11G', ], 'vm' : true, + 'firmware' : 'linux', }, ] diff --git a/test/integration-tests/integration-test-wrapper.py b/test/integration-tests/integration-test-wrapper.py index 90f40abfe2..d098910685 100755 --- a/test/integration-tests/integration-test-wrapper.py +++ b/test/integration-tests/integration-test-wrapper.py @@ -489,6 +489,22 @@ def main() -> None: else: rtc = None + # mkosi will use the UEFI secure boot firmware by default on UEFI platforms. However, this breaks on + # Github Actions in combination with KVM because of a HyperV bug so make sure we use the non secure + # boot firmware on Github Actions. + # TODO: Drop after the HyperV bug that breaks secure boot KVM guests is solved + if args.firmware == 'auto' and os.getenv('GITHUB_ACTIONS'): + firmware = 'uefi' + # Whenever possible, boot without an initrd. This requires the target distribution kernel to have the + # necessary modules (virtio-blk, ext4) builtin. + elif args.firmware == 'linux-noinitrd' and (summary.distribution, summary.release) not in ( + ('fedora', 'rawhide'), + ('arch', 'rolling'), + ): + firmware = 'linux' + else: + firmware = args.firmware + cmd = [ args.mkosi, '--directory', os.fspath(args.meson_source_dir), @@ -508,11 +524,7 @@ def main() -> None: '--runtime-scratch=no', *([f'--qemu-args=-rtc base={rtc}'] if rtc else []), *args.mkosi_args, - # mkosi will use the UEFI secure boot firmware by default on UEFI platforms. However, this breaks on - # Github Actions in combination with KVM because of a HyperV bug so make sure we use the non secure - # boot firmware on Github Actions. - # TODO: Drop after the HyperV bug that breaks secure boot KVM guests is solved - '--firmware', 'uefi' if args.firmware == 'auto' and os.getenv("GITHUB_ACTIONS") else args.firmware, + '--firmware', firmware, *(['--kvm', 'no'] if int(os.getenv('TEST_NO_KVM', '0')) else []), '--kernel-command-line-extra', ' '.join( diff --git a/test/integration-tests/meson.build b/test/integration-tests/meson.build index ecf3df7f09..cdcc1d8dba 100644 --- a/test/integration-tests/meson.build +++ b/test/integration-tests/meson.build @@ -7,7 +7,7 @@ integration_test_template = { 'timeout' : 1800, 'storage' : 'volatile', 'priority' : 0, - 'firmware' : 'linux', + 'firmware' : 'linux-noinitrd', 'enabled' : true, 'configuration' : { 'memory-accounting' : 'no',