From: Vincent Davis Jr <vince@underview.tech>
To: openembedded-core@lists.openembedded.org
Cc: Vincent Davis Jr <vince@underview.tech>
Subject: [PATCH v8 9/9] oe-selftest: add wic.Wic.test_grub_install_pcbios
Date: Thu, 14 Aug 2025 00:25:52 -0400 [thread overview]
Message-ID: <20250814042552.21887-9-vince@underview.tech> (raw)
In-Reply-To: <20250814042552.21887-1-vince@underview.tech>
wic.Wic.test_grub_install_pcbios test
Test updates to the bootimg_pcbios plugin that
enables support for installing grub directly
to the resulting wic image.
The test checks to see if the wics plugin
generates a wic image. Then see's if normal.mod
and grub.cfg are located in the boot partition.
Signed-off-by: Vincent Davis Jr <vince@underview.tech>
---
meta/lib/oeqa/selftest/cases/wic.py | 41 +++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index 680f99d381..44442e402d 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -215,6 +215,47 @@ class Wic(WicTestCase):
found, "The kernel image '{}' was not found in the boot partition".format(kimgtype)
)
+ @skipIfNotArch(['x86_64'])
+ def test_grub_install_pcbios(self):
+ """
+ Test the installation of the grub modules + config
+ into the boot directory in the resulting wic image.
+ """
+
+ # create a temporary file for the WKS content
+ with NamedTemporaryFile("w", suffix=".wks") as wks:
+ wks.write(
+ 'part --source bootimg_pcbios --sourceparams="loader-bios=grub" '
+ '--offset 1024 --fixed-size 78M --label boot --active\n'
+ 'bootloader --ptable msdos --source bootimg_pcbios\n'
+ )
+ wks.flush()
+ # create a temporary directory to extract the disk image to
+ with TemporaryDirectory() as tmpdir:
+ img = "core-image-minimal"
+ config = 'DEPENDS:pn-%s += "grub-native grub"' % (img)
+
+ self.append_config(config)
+ bitbake(img)
+ self.remove_config(config)
+
+ cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir)
+ runCmd(cmd)
+
+ wksname = os.path.splitext(os.path.basename(wks.name))[0]
+ out = glob(os.path.join(self.resultdir, "%s-*.direct" % wksname))
+ self.assertEqual(1, len(out))
+
+ sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools')
+
+ # Check if grub.cfg is installed
+ result = runCmd("wic ls %s:1/boot/grub -n %s" % (out[0], sysroot))
+ self.assertIn('grub', result.output)
+
+ # Check if normal.mod is installed
+ result = runCmd("wic ls %s:1/boot/grub/i386-pc -n %s" % (out[0], sysroot))
+ self.assertIn('normal', result.output)
+
def test_build_image_name(self):
"""Test wic create wictestdisk --image-name=core-image-minimal"""
cmd = "wic create wictestdisk --image-name=core-image-minimal -o %s" % self.resultdir
--
2.34.1
prev parent reply other threads:[~2025-08-14 4:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-14 4:25 [PATCH v8 1/9] bootimg_pcbios: move syslinux install into seperate functions Vincent Davis Jr
2025-08-14 4:25 ` [PATCH v8 2/9] bootimg_pcbios: move syslinux funcs to end of file Vincent Davis Jr
2025-08-14 4:25 ` [PATCH v8 3/9] bootimg_pcbios: seperate bootloader config creation Vincent Davis Jr
2025-08-14 4:25 ` [PATCH v8 4/9] bootimg_pcbios: cleanup _do_configure_syslinux function Vincent Davis Jr
2025-08-14 4:25 ` [PATCH v8 5/9] bootimg_pcbios: cleanup prepare and install syslinux funcs Vincent Davis Jr
2025-08-14 4:25 ` [PATCH v8 6/9] bootimg_pcbios: add funcs to configure booting with grub Vincent Davis Jr
2025-08-14 4:25 ` [PATCH v8 7/9] bootimg_pcbios: include grub as an optional bootloader Vincent Davis Jr
2025-08-14 4:25 ` [PATCH v8 8/9] bootimg_pcbios: add help and usage comments Vincent Davis Jr
2025-08-14 4:25 ` Vincent Davis Jr [this message]
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=20250814042552.21887-9-vince@underview.tech \
--to=vince@underview.tech \
--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