diff options
| author | Vincent Davis Jr <vince@underview.tech> | 2025-08-14 00:25:52 -0400 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-08-14 10:31:11 +0100 |
| commit | f9e0afedea37edeabc7dcb03bddd7a60fe8d6945 (patch) | |
| tree | 7df66474bc2ec51ba7e08cb599e32551bdbc9055 /meta/lib | |
| parent | c74dfd8f81a3dfde9d4d9321a64d4028c990a35f (diff) | |
| download | poky-f9e0afedea37edeabc7dcb03bddd7a60fe8d6945.tar.gz | |
oe-selftest: add wic.Wic.test_grub_install_pcbios
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.
(From OE-Core rev: 23b2a406c7d83f7b81aed85819b4643b93978ac9)
Signed-off-by: Vincent Davis Jr <vince@underview.tech>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/wic.py | 41 |
1 files changed, 41 insertions, 0 deletions
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): | |||
| 215 | found, "The kernel image '{}' was not found in the boot partition".format(kimgtype) | 215 | found, "The kernel image '{}' was not found in the boot partition".format(kimgtype) |
| 216 | ) | 216 | ) |
| 217 | 217 | ||
| 218 | @skipIfNotArch(['x86_64']) | ||
| 219 | def test_grub_install_pcbios(self): | ||
| 220 | """ | ||
| 221 | Test the installation of the grub modules + config | ||
| 222 | into the boot directory in the resulting wic image. | ||
| 223 | """ | ||
| 224 | |||
| 225 | # create a temporary file for the WKS content | ||
| 226 | with NamedTemporaryFile("w", suffix=".wks") as wks: | ||
| 227 | wks.write( | ||
| 228 | 'part --source bootimg_pcbios --sourceparams="loader-bios=grub" ' | ||
| 229 | '--offset 1024 --fixed-size 78M --label boot --active\n' | ||
| 230 | 'bootloader --ptable msdos --source bootimg_pcbios\n' | ||
| 231 | ) | ||
| 232 | wks.flush() | ||
| 233 | # create a temporary directory to extract the disk image to | ||
| 234 | with TemporaryDirectory() as tmpdir: | ||
| 235 | img = "core-image-minimal" | ||
| 236 | config = 'DEPENDS:pn-%s += "grub-native grub"' % (img) | ||
| 237 | |||
| 238 | self.append_config(config) | ||
| 239 | bitbake(img) | ||
| 240 | self.remove_config(config) | ||
| 241 | |||
| 242 | cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir) | ||
| 243 | runCmd(cmd) | ||
| 244 | |||
| 245 | wksname = os.path.splitext(os.path.basename(wks.name))[0] | ||
| 246 | out = glob(os.path.join(self.resultdir, "%s-*.direct" % wksname)) | ||
| 247 | self.assertEqual(1, len(out)) | ||
| 248 | |||
| 249 | sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools') | ||
| 250 | |||
| 251 | # Check if grub.cfg is installed | ||
| 252 | result = runCmd("wic ls %s:1/boot/grub -n %s" % (out[0], sysroot)) | ||
| 253 | self.assertIn('grub', result.output) | ||
| 254 | |||
| 255 | # Check if normal.mod is installed | ||
| 256 | result = runCmd("wic ls %s:1/boot/grub/i386-pc -n %s" % (out[0], sysroot)) | ||
| 257 | self.assertIn('normal', result.output) | ||
| 258 | |||
| 218 | def test_build_image_name(self): | 259 | def test_build_image_name(self): |
| 219 | """Test wic create wictestdisk --image-name=core-image-minimal""" | 260 | """Test wic create wictestdisk --image-name=core-image-minimal""" |
| 220 | cmd = "wic create wictestdisk --image-name=core-image-minimal -o %s" % self.resultdir | 261 | cmd = "wic create wictestdisk --image-name=core-image-minimal -o %s" % self.resultdir |
