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 | |
| 8 | import re |
| 9 | |
| 10 | from oeqa.selftest.case import OESelftestTestCase |
| 11 | from oeqa.utils.commands import bitbake, runqemu, get_bb_var |
| 12 | |
| 13 | class GenericEFITest(OESelftestTestCase): |
| 14 | """EFI booting test class""" |
| 15 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 16 | cmd_common = "runqemu nographic serial wic ovmf" |
| 17 | efi_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 | """ |
| 28 | EFI_PROVIDER = "%s" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 29 | IMAGE_FSTYPES:pn-%s:append = " wic" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 30 | MACHINE = "%s" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 31 | MACHINE_FEATURES:append = " efi" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 32 | WKS_FILE = "efi-bootdisk.wks.in" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 33 | IMAGE_INSTALL:append = " grub-efi systemd-boot kernel-image-bzimage" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 34 | """ |
| 35 | % (self.efi_provider, self.image, self.machine)) |
| 36 | if not self.recipes_built: |
| 37 | bitbake("ovmf") |
| 38 | bitbake(self.image) |
| 39 | self.recipes_built = True |
| 40 | |
| 41 | @classmethod |
| 42 | def test_boot_efi(self): |
| 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) |