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