1# Based on runqemu.py test file
2#
3# Copyright (c) 2017 Wind River Systems, Inc.
4#
5# SPDX-License-Identifier: MIT
6#
7
8from oeqa.selftest.case import OESelftestTestCase
9from oeqa.utils.commands import bitbake, runqemu
10from oeqa.core.decorator.data import skipIfNotMachine
11import oe.types
12
13class GenericEFITest(OESelftestTestCase):
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.get('QEMU_USE_KVM', 0), self.td["TARGET_ARCH"]):
19            cmd += " kvm"
20        image = "core-image-minimal"
21
22        self.write_config("""
23EFI_PROVIDER = "systemd-boot"
24IMAGE_FSTYPES:pn-%s:append = " wic"
25MACHINE_FEATURES:append = " efi"
26WKS_FILE = "efi-bootdisk.wks.in"
27IMAGE_INSTALL:append = " grub-efi systemd-boot kernel-image-bzimage"
28"""
29% (image))
30
31        bitbake(image + " ovmf")
32        with runqemu(image, ssh=False, launch_cmd=cmd) as qemu:
33            self.assertTrue(qemu.runner.logged, "Failed: %s" % cmd)
34