summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2022-11-09 19:31:24 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-11-11 13:43:40 +0000
commitba9d3e732a1499ad985f2f5a70fe0f76580f580a (patch)
treed7e5dbc834737e72b89488201f2d47d071f51fe9
parent4c790357bf59d054ecbdc16d7a447fcd3aeaddd2 (diff)
downloadpoky-ba9d3e732a1499ad985f2f5a70fe0f76580f580a.tar.gz
oeqa/selftest/efibootpartition: improve test
This test was overly complex with a setUp() method for a single test case, which was marked as a class function for no good reason. Generalise the test so that it has the possibility of working on more machines in the future, add a decorator so that it only runs on qemux86-64, and respect QEMU_USE_KVM to speed up test execution. (From OE-Core rev: 2bc2ee171f976807053b7da44c1eedbb07c10949) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/selftest/cases/efibootpartition.py41
1 files changed, 14 insertions, 27 deletions
diff --git a/meta/lib/oeqa/selftest/cases/efibootpartition.py b/meta/lib/oeqa/selftest/cases/efibootpartition.py
index 26de3a07c9..e17da9f9a0 100644
--- a/meta/lib/oeqa/selftest/cases/efibootpartition.py
+++ b/meta/lib/oeqa/selftest/cases/efibootpartition.py
@@ -5,42 +5,29 @@
5# SPDX-License-Identifier: MIT 5# SPDX-License-Identifier: MIT
6# 6#
7 7
8import re
9
10from oeqa.selftest.case import OESelftestTestCase 8from oeqa.selftest.case import OESelftestTestCase
11from oeqa.utils.commands import bitbake, runqemu, get_bb_var 9from oeqa.utils.commands import bitbake, runqemu
10from oeqa.core.decorator.data import skipIfNotMachine
11import oe.types
12 12
13class GenericEFITest(OESelftestTestCase): 13class GenericEFITest(OESelftestTestCase):
14 """EFI booting test class""" 14 """EFI booting test class"""
15 @skipIfNotMachine("qemux86-64", "test is qemux86-64 specific currently")
16 def test_boot_efi(self):
17 cmd = "runqemu nographic serial wic ovmf"
18 if oe.types.qemu_use_kvm(self.td['QEMU_USE_KVM'], self.td["TARGET_ARCH"]):
19 cmd += " kvm"
20 image = "core-image-minimal"
15 21
16 cmd_common = "runqemu nographic serial wic ovmf" 22 self.write_config("""
17 efi_provider = "systemd-boot" 23EFI_PROVIDER = "systemd-boot"
18 image = "core-image-minimal"
19 machine = "qemux86-64"
20 recipes_built = False
21
22 @classmethod
23 def setUpLocal(self):
24 super(GenericEFITest, self).setUpLocal(self)
25
26 self.write_config(self,
27"""
28EFI_PROVIDER = "%s"
29IMAGE_FSTYPES:pn-%s:append = " wic" 24IMAGE_FSTYPES:pn-%s:append = " wic"
30MACHINE = "%s"
31MACHINE_FEATURES:append = " efi" 25MACHINE_FEATURES:append = " efi"
32WKS_FILE = "efi-bootdisk.wks.in" 26WKS_FILE = "efi-bootdisk.wks.in"
33IMAGE_INSTALL:append = " grub-efi systemd-boot kernel-image-bzimage" 27IMAGE_INSTALL:append = " grub-efi systemd-boot kernel-image-bzimage"
34""" 28"""
35% (self.efi_provider, self.image, self.machine)) 29% (image))
36 if not self.recipes_built:
37 bitbake("ovmf")
38 bitbake(self.image)
39 self.recipes_built = True
40 30
41 @classmethod 31 bitbake(image + " ovmf")
42 def test_boot_efi(self): 32 with runqemu(image, ssh=False, launch_cmd=cmd) as qemu:
43 """Test generic boot partition with qemu"""
44 cmd = "%s %s" % (self.cmd_common, self.machine)
45 with runqemu(self.image, ssh=False, launch_cmd=cmd) as qemu:
46 self.assertTrue(qemu.runner.logged, "Failed: %s" % cmd) 33 self.assertTrue(qemu.runner.logged, "Failed: %s" % cmd)