Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1 | # Based on runqemu.py test file |
| 2 | # |
| 3 | # Copyright (c) 2017 Wind River Systems, Inc. |
| 4 | # |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 5 | # SPDX-License-Identifier: MIT |
| 6 | # |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 7 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 8 | from oeqa.selftest.case import OESelftestTestCase |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 9 | from oeqa.utils.commands import bitbake, runqemu |
| 10 | from oeqa.core.decorator.data import skipIfNotMachine |
| 11 | import oe.types |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 12 | |
| 13 | class GenericEFITest(OESelftestTestCase): |
| 14 | """EFI booting test class""" |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 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" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 21 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 22 | self.write_config(""" |
| 23 | EFI_PROVIDER = "systemd-boot" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 24 | IMAGE_FSTYPES:pn-%s:append = " wic" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 25 | MACHINE_FEATURES:append = " efi" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 26 | WKS_FILE = "efi-bootdisk.wks.in" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 27 | IMAGE_INSTALL:append = " grub-efi systemd-boot kernel-image-bzimage" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 28 | """ |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 29 | % (image)) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 30 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 31 | bitbake(image + " ovmf") |
| 32 | with runqemu(image, ssh=False, launch_cmd=cmd) as qemu: |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 33 | self.assertTrue(qemu.runner.logged, "Failed: %s" % cmd) |