1# Based on runqemu.py test file
2#
3# Copyright (c) 2017 Wind River Systems, Inc.
4#
5
6import re
7
8from oeqa.selftest.case import OESelftestTestCase
9from oeqa.utils.commands import bitbake, runqemu, get_bb_var
10
11class GenericEFITest(OESelftestTestCase):
12    """EFI booting test class"""
13
14    cmd_common = "runqemu nographic serial wic ovmf"
15    efi_provider = "systemd-boot"
16    image = "core-image-minimal"
17    machine = "qemux86-64"
18    recipes_built = False
19
20    @classmethod
21    def setUpLocal(self):
22        super(GenericEFITest, self).setUpLocal(self)
23
24        self.write_config(self,
25"""
26EFI_PROVIDER = "%s"
27IMAGE_FSTYPES_pn-%s_append = " wic"
28MACHINE = "%s"
29MACHINE_FEATURES_append = " efi"
30WKS_FILE = "efi-bootdisk.wks.in"
31IMAGE_INSTALL_append = " grub-efi systemd-boot kernel-image-bzimage"
32"""
33% (self.efi_provider, self.image, self.machine))
34        if not self.recipes_built:
35            bitbake("ovmf")
36            bitbake(self.image)
37            self.recipes_built = True
38
39    @classmethod
40    def test_boot_efi(self):
41        """Test generic boot partition with qemu"""
42        cmd = "%s %s" % (self.cmd_common, self.machine)
43        with runqemu(self.image, ssh=False, launch_cmd=cmd) as qemu:
44            self.assertTrue(qemu.runner.logged, "Failed: %s" % cmd)
45