From: Mikko Rapeli <mikko.rapeli@linaro.org>
To: openembedded-core@lists.openembedded.org
Cc: Mikko Rapeli <mikko.rapeli@linaro.org>
Subject: [PATCH v3 12/12] oeqa selftest wic.py: support UKIs via uki.bbclass
Date: Thu, 19 Sep 2024 17:37:06 +0300 [thread overview]
Message-ID: <20240919143706.6074-13-mikko.rapeli@linaro.org> (raw)
In-Reply-To: <20240919143706.6074-1-mikko.rapeli@linaro.org>
Use label to detect rootfs since UKI with kernel command
line is generated before rootfs is generated by wic.
Adapt wic tests to build and boot uki.bbclass generated
UKIs.
Keeping one tests in wic.py and rest of the UKI features
are tested with dedicated uki.py test.
Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
---
meta-selftest/wic/test_efi_plugin.wks | 5 ++--
meta/lib/oeqa/selftest/cases/wic.py | 42 ++++++++++++++++++++-------
2 files changed, 34 insertions(+), 13 deletions(-)
diff --git a/meta-selftest/wic/test_efi_plugin.wks b/meta-selftest/wic/test_efi_plugin.wks
index 1603d6c4bb..e876a4be0e 100644
--- a/meta-selftest/wic/test_efi_plugin.wks
+++ b/meta-selftest/wic/test_efi_plugin.wks
@@ -1,6 +1,5 @@
# short-description: This file is used in oe-selftest wic module to test efi plugin
-
-part /boot --source bootimg-efi --sourceparams="loader=systemd-boot,create-unified-kernel-image=true,initrd=${INITRAMFS_IMAGE}-${MACHINE}.${INITRAMFS_FSTYPES}" --active --align 1024 --use-uuid
-part / --source rootfs --fstype=ext4 --align 1024 --use-uuid
+part /boot --source bootimg-efi --sourceparams="loader=systemd-boot" --active --align 1024 --use-uuid
+part / --source rootfs --fstype=ext4 --align 1024 --use-uuid --label root
bootloader --timeout=0 --append="console=ttyS0,115200n8"
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index 7d5da74de4..8b680a87a6 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -1292,24 +1292,46 @@ class Wic2(WicTestCase):
@skipIfNotArch(['i586', 'i686', 'x86_64'])
@OETestTag("runqemu")
def test_efi_plugin_unified_kernel_image_qemu(self):
- """Test efi plugin's Unified Kernel Image feature in qemu"""
- config = 'IMAGE_FSTYPES = "wic"\n'\
- 'INITRAMFS_IMAGE = "core-image-minimal-initramfs"\n'\
- 'WKS_FILE = "test_efi_plugin.wks"\n'\
- 'MACHINE_FEATURES:append = " efi"\n'
+ """Test Unified Kernel Image feature in qemu without systemd in initramfs or rootfs"""
+ config = """
+# efi firmware must load systemd-boot, not grub
+EFI_PROVIDER = "systemd-boot"
+
+# image format must be wic, needs esp partition for firmware etc
+IMAGE_FSTYPES:pn-core-image-base:append = " wic"
+WKS_FILE = "test_efi_plugin.wks"
+
+# efi, uki and systemd features must be enabled
+MACHINE_FEATURES:append = " efi"
+DISTRO_FEATURES_NATIVE:append = " systemd"
+IMAGE_CLASSES:append:pn-core-image-base = " uki"
+
+# uki embeds also an initrd, no systemd or udev
+INITRAMFS_IMAGE = "core-image-initramfs-boot"
+
+# runqemu must not load kernel separately, it's in the uki
+QB_KERNEL_ROOT = ""
+QB_DEFAULT_KERNEL = "none"
+
+# boot command line provided via uki, not via bootloader
+UKI_CMDLINE = "rootwait root=LABEL=root console=${KERNEL_CONSOLE}"
+
+"""
self.append_config(config)
- bitbake('core-image-minimal core-image-minimal-initramfs ovmf')
+ bitbake('core-image-base ovmf')
+ runqemu_params = get_bb_var('TEST_RUNQEMUPARAMS', 'core-image-base')
+ uki_filename = get_bb_var('UKI_FILENAME', 'core-image-base')
self.remove_config(config)
- with runqemu('core-image-minimal', ssh=False,
- runqemuparams='nographic ovmf', image_fstype='wic') as qemu:
+ with runqemu('core-image-base', ssh=False,
+ runqemuparams='%s nographic ovmf' % (runqemu_params), image_fstype='wic') as qemu:
# Check that /boot has EFI bootx64.efi (required for EFI)
cmd = "ls /boot/EFI/BOOT/bootx64.efi | wc -l"
status, output = qemu.run_serial(cmd)
self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
self.assertEqual(output, '1')
- # Check that /boot has EFI/Linux/linux.efi (required for Unified Kernel Images auto detection)
- cmd = "ls /boot/EFI/Linux/linux.efi | wc -l"
+ # Check that /boot has EFI/Linux/${UKI_FILENAME} (required for Unified Kernel Images auto detection)
+ cmd = "ls /boot/EFI/Linux/%s | wc -l" % (uki_filename)
status, output = qemu.run_serial(cmd)
self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
self.assertEqual(output, '1')
--
2.34.1
next prev parent reply other threads:[~2024-09-19 14:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-19 14:36 [PATCH v3 00/12] systemd uki support Mikko Rapeli
2024-09-19 14:36 ` [PATCH v3 01/12] python3-pefile: add recipe from meta-openembedded Mikko Rapeli
2024-09-20 7:24 ` [OE-core] " Richard Purdie
2024-09-22 8:15 ` Mikko Rapeli
2024-09-19 14:36 ` [PATCH v3 02/12] maintainers.inc: add python3-pefile Mikko Rapeli
2024-09-19 14:36 ` [PATCH v3 03/12] systemd-boot-native: add runtime dependency to python3-pefile-native Mikko Rapeli
2024-09-19 14:36 ` [PATCH v3 04/12] uki.bbclass: add class for building Unified Kernel Images (UKI) Mikko Rapeli
2024-09-19 14:36 ` [PATCH v3 05/12] image_types_wic.bbclass: set systemd-boot and os-release dependency for all archs Mikko Rapeli
2024-09-19 14:37 ` [PATCH v3 06/12] wic bootimg-efi.py: keep timestamps and add debug prints Mikko Rapeli
2024-09-19 14:37 ` [PATCH v3 07/12] wic bootimg-efi.py: change UKI support from wic plugin to uki.bbclass Mikko Rapeli
2024-09-19 14:37 ` [PATCH v3 08/12] oeqa selftest uki.py: add tests for uki.bbclass Mikko Rapeli
2024-09-19 14:37 ` [PATCH v3 09/12] oeqa selftest efibootpartition.py: add TEST_RUNQEMUPARAMS to runqemu Mikko Rapeli
2024-09-19 14:37 ` [PATCH v3 10/12] oeqa selftest efibootpartition.py: remove systemd-boot from grub-efi test Mikko Rapeli
2024-09-19 14:37 ` [PATCH v3 11/12] oeqa selftest wic.py: add TEST_RUNQEMUPARAMS to runqemu Mikko Rapeli
2024-09-19 14:37 ` Mikko Rapeli [this message]
2024-09-20 7:26 ` [OE-core] [PATCH v3 00/12] systemd uki support Richard Purdie
2024-09-22 8:17 ` Mikko Rapeli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240919143706.6074-13-mikko.rapeli@linaro.org \
--to=mikko.rapeli@linaro.org \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox