diff options
Diffstat (limited to 'meta-yocto-bsp/lib/oeqa/selftest')
-rw-r--r-- | meta-yocto-bsp/lib/oeqa/selftest/cases/systemd_boot.py | 54 |
1 files changed, 50 insertions, 4 deletions
diff --git a/meta-yocto-bsp/lib/oeqa/selftest/cases/systemd_boot.py b/meta-yocto-bsp/lib/oeqa/selftest/cases/systemd_boot.py index 848cdf7852..dd5eeec163 100644 --- a/meta-yocto-bsp/lib/oeqa/selftest/cases/systemd_boot.py +++ b/meta-yocto-bsp/lib/oeqa/selftest/cases/systemd_boot.py | |||
@@ -2,25 +2,26 @@ import os | |||
2 | 2 | ||
3 | from oeqa.selftest.case import OESelftestTestCase | 3 | from oeqa.selftest.case import OESelftestTestCase |
4 | from oeqa.core.decorator.oeid import OETestID | 4 | from oeqa.core.decorator.oeid import OETestID |
5 | from oeqa.core.decorator.depends import OETestDepends | ||
5 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu | 6 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu |
6 | 7 | ||
7 | class Systemdboot(OESelftestTestCase): | 8 | class Systemdboot(OESelftestTestCase): |
8 | def _common_setup(self): | 9 | def _common_setup(self): |
9 | """ | 10 | """ |
10 | Common setup for test cases: 1445, XXXX | 11 | Common setup for test cases: 1445, 1528 |
11 | """ | 12 | """ |
12 | 13 | ||
13 | # Set EFI_PROVIDER = "gummiboot" and MACHINE = "genericx86-64" in conf/local.conf | 14 | # Set EFI_PROVIDER = "systemdboot" and MACHINE = "genericx86-64" in conf/local.conf |
14 | features = 'EFI_PROVIDER = "systemd-boot"\n' | 15 | features = 'EFI_PROVIDER = "systemd-boot"\n' |
15 | features += 'MACHINE = "genericx86-64"' | 16 | features += 'MACHINE = "genericx86-64"' |
16 | self.append_config(features) | 17 | self.append_config(features) |
17 | 18 | ||
18 | def _common_build(self): | 19 | def _common_build(self): |
19 | """ | 20 | """ |
20 | Common build for test cases: 1445 , XXXX | 21 | Common build for test cases: 1445 , 1528 |
21 | """ | 22 | """ |
22 | 23 | ||
23 | # Build a genericx86-64/efi gummiboot image | 24 | # Build a genericx86-64/efi systemdboot image |
24 | bitbake('mtools-native core-image-minimal') | 25 | bitbake('mtools-native core-image-minimal') |
25 | 26 | ||
26 | 27 | ||
@@ -50,3 +51,48 @@ class Systemdboot(OESelftestTestCase): | |||
50 | 51 | ||
51 | found = os.path.isfile(systemdbootfile) | 52 | found = os.path.isfile(systemdbootfile) |
52 | self.assertTrue(found, 'Systemd-Boot file %s not found' % systemdbootfile) | 53 | self.assertTrue(found, 'Systemd-Boot file %s not found' % systemdbootfile) |
54 | |||
55 | @OETestID(1528) | ||
56 | @OETestDepends(['systemd_boot.Systemdboot.test_efi_systemdboot_images_can_be_built']) | ||
57 | def test_image_efi_file(self): | ||
58 | |||
59 | """ | ||
60 | Summary: Check if EFI bootloader for systemd is correctly build | ||
61 | Dependencies: Image was built correctly on testcase 1445 | ||
62 | Steps: 1. Copy bootx64.efi file form the hddimg created | ||
63 | under build/tmp/deploy/images/genericx86-64 | ||
64 | 2. Check bootx64.efi was copied form hddimg | ||
65 | 3. Verify the checksums from the copied and previously | ||
66 | created file are equal. | ||
67 | Expected : Systemd-bootx64.efi and bootx64.efi should be the same | ||
68 | hence checksums should be equal. | ||
69 | Product: oe-core | ||
70 | Author: Jose Perez Carranza <jose.perez.carranza at linux-intel.com> | ||
71 | AutomatedBy: Jose Perez Carranza <jose.perez.carranza at linux-intel.com> | ||
72 | """ | ||
73 | |||
74 | systemdbootfile = os.path.join(get_bb_var('DEPLOY_DIR'), 'images', 'genericx86-64', | ||
75 | 'systemd-bootx64.efi') | ||
76 | systemdbootimage = os.path.join(get_bb_var('DEPLOY_DIR'), 'images', 'genericx86-64', | ||
77 | 'core-image-minimal-genericx86-64.hddimg') | ||
78 | imagebootfile = os.path.join(get_bb_var('DEPLOY_DIR'), 'images', 'genericx86-64', | ||
79 | 'bootx64.efi') | ||
80 | mcopynative = os.path.join(get_bb_var('STAGING_BINDIR_NATIVE'), 'mcopy') | ||
81 | |||
82 | #Clean environment before start the test | ||
83 | if os.path.isfile(imagebootfile): | ||
84 | runCmd('rm -f %s' % imagebootfile) | ||
85 | |||
86 | #Step 1 | ||
87 | runCmd('%s -i %s ::EFI/BOOT/bootx64.efi %s' % (mcopynative ,systemdbootimage, | ||
88 | imagebootfile)) | ||
89 | |||
90 | #Step 2 | ||
91 | found = os.path.isfile(imagebootfile) | ||
92 | self.assertTrue(found, 'bootx64.efi file %s was not copied from image' | ||
93 | % imagebootfile) | ||
94 | |||
95 | #Step 3 | ||
96 | result = runCmd('md5sum %s %s' % (systemdbootfile, imagebootfile)) | ||
97 | self.assertEqual(result.output.split()[0], result.output.split()[2], | ||
98 | '%s was not correclty generated' % imagebootfile) | ||