summaryrefslogtreecommitdiffstats
path: root/meta-yocto-bsp/lib/oeqa/selftest
diff options
context:
space:
mode:
Diffstat (limited to 'meta-yocto-bsp/lib/oeqa/selftest')
-rw-r--r--meta-yocto-bsp/lib/oeqa/selftest/cases/systemd_boot.py61
1 files changed, 18 insertions, 43 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 26c775c09e..dfd739ae77 100644
--- a/meta-yocto-bsp/lib/oeqa/selftest/cases/systemd_boot.py
+++ b/meta-yocto-bsp/lib/oeqa/selftest/cases/systemd_boot.py
@@ -6,26 +6,9 @@ from oeqa.core.decorator.depends import OETestDepends
6from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu 6from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu
7 7
8class Systemdboot(OESelftestTestCase): 8class Systemdboot(OESelftestTestCase):
9 def _common_setup(self):
10 """
11 Common setup for test cases: 1445, 1528
12 """
13
14 # Set EFI_PROVIDER = "systemdboot" and MACHINE = "genericx86-64" in conf/local.conf
15 features = 'EFI_PROVIDER = "systemd-boot"\n'
16 features += 'MACHINE = "genericx86-64"'
17 self.append_config(features)
18
19 def _common_build(self):
20 """
21 Common build for test cases: 1445 , 1528
22 """
23
24 # Build a genericx86-64/efi systemdboot image
25 bitbake('mtools-native core-image-minimal')
26
27 9
28 @OETestID(1445) 10 @OETestID(1445)
11 @OETestID(1528)
29 def test_efi_systemdboot_images_can_be_built(self): 12 def test_efi_systemdboot_images_can_be_built(self):
30 """ 13 """
31 Summary: Check if systemd-boot images can be built correctly 14 Summary: Check if systemd-boot images can be built correctly
@@ -36,26 +19,25 @@ class Systemdboot(OESelftestTestCase):
36 AutomatedBy: Jose Perez Carranza <jose.perez.carranza@intel.com> 19 AutomatedBy: Jose Perez Carranza <jose.perez.carranza@intel.com>
37 """ 20 """
38 21
39 # We'd use DEPLOY_DIR_IMAGE here, except that we need its value for 22 # Set EFI_PROVIDER = "systemdboot" and MACHINE = "genericx86-64" in conf/local.conf
40 # MACHINE="genericx86-64 which is probably not the one configured 23 features = 'EFI_PROVIDER = "systemd-boot"\n'
41 systemdbootfile = os.path.join(get_bb_var('DEPLOY_DIR'), 'images', 'genericx86-64', 'systemd-bootx64.efi') 24 features += 'MACHINE = "genericx86-64"'
25 self.append_config(features)
42 26
43 self._common_setup() 27 deploydir = get_bb_var('DEPLOY_DIR_IMAGE', "core-image-minimal")
28 systemdbootfile = os.path.join(deploydir, 'systemd-bootx64.efi')
44 29
45 # Ensure we're actually testing that this gets built and not that 30 # Ensure we're actually testing that this gets built and not that
46 # it was around from an earlier build 31 # it was around from an earlier build
47 bitbake('-c clean systemd-boot') 32 bitbake('-c clean systemd-boot')
48 runCmd('rm -f %s' % systemdbootfile) 33 runCmd('rm -f %s' % systemdbootfile)
49 34
50 self._common_build() 35 # Build a genericx86-64/efi systemdboot image
36 bitbake('mtools-native core-image-minimal')
51 37
52 found = os.path.isfile(systemdbootfile) 38 found = os.path.isfile(systemdbootfile)
53 self.assertTrue(found, 'Systemd-Boot file %s not found' % systemdbootfile) 39 self.assertTrue(found, 'Systemd-Boot file %s not found' % systemdbootfile)
54 40
55 @OETestID(1528)
56 @OETestDepends(['systemd_boot.Systemdboot.test_efi_systemdboot_images_can_be_built'])
57 def test_image_efi_file(self):
58
59 """ 41 """
60 Summary: Check if EFI bootloader for systemd is correctly build 42 Summary: Check if EFI bootloader for systemd is correctly build
61 Dependencies: Image was built correctly on testcase 1445 43 Dependencies: Image was built correctly on testcase 1445
@@ -71,28 +53,21 @@ class Systemdboot(OESelftestTestCase):
71 AutomatedBy: Jose Perez Carranza <jose.perez.carranza at linux-intel.com> 53 AutomatedBy: Jose Perez Carranza <jose.perez.carranza at linux-intel.com>
72 """ 54 """
73 55
74 systemdbootfile = os.path.join(get_bb_var('DEPLOY_DIR'), 'images', 'genericx86-64', 56 systemdbootimage = os.path.join(deploydir, 'core-image-minimal-genericx86-64.hddimg')
75 'systemd-bootx64.efi') 57 imagebootfile = os.path.join(deploydir, 'bootx64.efi')
76 systemdbootimage = os.path.join(get_bb_var('DEPLOY_DIR'), 'images', 'genericx86-64', 58 mcopynative = os.path.join(get_bb_var('STAGING_BINDIR_NATIVE', "core-image-minimal"), 'mcopy')
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 59
82 #Clean environment before start the test 60 # Clean environment before start the test
83 if os.path.isfile(imagebootfile): 61 if os.path.isfile(imagebootfile):
84 runCmd('rm -f %s' % imagebootfile) 62 runCmd('rm -f %s' % imagebootfile)
85 63
86 #Step 1 64 runCmd('%s -i %s ::EFI/BOOT/bootx64.efi %s' % (mcopynative ,systemdbootimage,
87 runCmd('%s -i %s ::EFI/BOOT/bootx64.efi %s' % (mcopynative ,systemdbootimage,
88 imagebootfile)) 65 imagebootfile))
89 66
90 #Step 2 67 found = os.path.isfile(imagebootfile)
91 found = os.path.isfile(imagebootfile) 68 self.assertTrue(found, 'bootx64.efi file %s was not copied from image'
92 self.assertTrue(found, 'bootx64.efi file %s was not copied from image'
93 % imagebootfile) 69 % imagebootfile)
94 70
95 #Step 3 71 result = runCmd('md5sum %s %s' % (systemdbootfile, imagebootfile))
96 result = runCmd('md5sum %s %s' % (systemdbootfile, imagebootfile)) 72 self.assertEqual(result.output.split()[0], result.output.split()[2],
97 self.assertEqual(result.output.split()[0], result.output.split()[2],
98 '%s was not correclty generated' % imagebootfile) 73 '%s was not correclty generated' % imagebootfile)