]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: Boot integration test VMs without an initrd if possible
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 27 Mar 2025 13:24:28 +0000 (14:24 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 28 Mar 2025 10:40:39 +0000 (11:40 +0100)
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/integration-tests/TEST-08-INITRD/meson.build
test/integration-tests/TEST-24-CRYPTSETUP/meson.build
test/integration-tests/integration-test-wrapper.py
test/integration-tests/meson.build

index dcbfe20134ce29fbc205a79846b3e8fac08e0eb7..5425096a563525b7af20ce9b04232b44deb93619 100644 (file)
@@ -8,5 +8,6 @@ integration_tests += [
                 ],
                 'exit-code' : 124,
                 'vm' : true,
+                'firmware' : 'linux',
         },
 ]
index 4d65e1d9abb55202add1bc52be8383d3542b5552..c9e0271e963f87860be3b1015ee66908f95a9f6c 100644 (file)
@@ -22,5 +22,6 @@ integration_tests += [
                         '--runtime-size=11G',
                 ],
                 'vm' : true,
+                'firmware' : 'linux',
         },
 ]
index 90f40abfe21dbf45ec66a9d2180b852ae3cc91e6..d0989106854c0d9226ca7a4e71250d2bfc82e1b9 100755 (executable)
@@ -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(
index ecf3df7f090a556cc32b1766eb9d05b9451ca187..cdcc1d8dba3a55f7368b8dfada6672c5e56eedf0 100644 (file)
@@ -7,7 +7,7 @@ integration_test_template = {
         'timeout' : 1800,
         'storage' : 'volatile',
         'priority' : 0,
-        'firmware' : 'linux',
+        'firmware' : 'linux-noinitrd',
         'enabled' : true,
         'configuration' : {
                 'memory-accounting' : 'no',