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.
This commit is contained in:
Daan De Meyer
2025-03-27 14:24:28 +01:00
parent c4fcd6ea78
commit 51b4920746
4 changed files with 20 additions and 6 deletions

View File

@@ -8,5 +8,6 @@ integration_tests += [
],
'exit-code' : 124,
'vm' : true,
'firmware' : 'linux',
},
]

View File

@@ -22,5 +22,6 @@ integration_tests += [
'--runtime-size=11G',
],
'vm' : true,
'firmware' : 'linux',
},
]

View File

@@ -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(

View 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',