diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2015-07-28 11:19:02 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-07-28 11:26:10 +0100 |
commit | 5e357ed88f40e471f7e3b7ea3d697410a9cb980b (patch) | |
tree | 00b14bde71e06af257d2873e098fc8b029f11ee3 /meta-yocto-bsp/lib/oeqa/selftest | |
parent | 1b88b7426a3c5e3b4427501e67df141b0ee17934 (diff) | |
download | poky-5e357ed88f40e471f7e3b7ea3d697410a9cb980b.tar.gz |
oe-selftest: restore gummiboot tests
These are the gummiboot tests recently removed from OE-Core, with the
following changes:
* Make them use MACHINE = "genericx86-64" instead of "nuc" and remove
all usage of meta-intel
* Use DEPLOY_DIR instead of assuming build directory will be in the
default path relative to COREBASE
* Fix build test to actually check if the file was created as part of
the test instead of possibly being around from a previous build
* Fix wic test to actually check the output to find the name of the
.direct file that wic has created, instead of passing if any .direct
file happens to exist in /var/tmp/wic
(We can now add these in this layer courtesy of Chris Larson's OE-Core
commit 182b8ed9f26ed8b6a8eb6dcaec82db9aca14b010).
(From meta-yocto rev: 8e945e39327869c6b53959c5eb324ba3e4cb0b20)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta-yocto-bsp/lib/oeqa/selftest')
-rw-r--r-- | meta-yocto-bsp/lib/oeqa/selftest/__init__.py | 0 | ||||
-rw-r--r-- | meta-yocto-bsp/lib/oeqa/selftest/gummiboot.py | 83 |
2 files changed, 83 insertions, 0 deletions
diff --git a/meta-yocto-bsp/lib/oeqa/selftest/__init__.py b/meta-yocto-bsp/lib/oeqa/selftest/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/meta-yocto-bsp/lib/oeqa/selftest/__init__.py | |||
diff --git a/meta-yocto-bsp/lib/oeqa/selftest/gummiboot.py b/meta-yocto-bsp/lib/oeqa/selftest/gummiboot.py new file mode 100644 index 0000000000..00aa36f60d --- /dev/null +++ b/meta-yocto-bsp/lib/oeqa/selftest/gummiboot.py | |||
@@ -0,0 +1,83 @@ | |||
1 | from oeqa.selftest.base import oeSelfTest | ||
2 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu | ||
3 | from oeqa.utils.decorators import testcase | ||
4 | import re | ||
5 | import os | ||
6 | import sys | ||
7 | import logging | ||
8 | |||
9 | |||
10 | class Gummiboot(oeSelfTest): | ||
11 | |||
12 | def _common_setup(self): | ||
13 | """ | ||
14 | Common setup for test cases: 1101, 1103 | ||
15 | """ | ||
16 | |||
17 | # Set EFI_PROVIDER = "gummiboot" and MACHINE = "genericx86-64" in conf/local.conf | ||
18 | features = 'EFI_PROVIDER = "gummiboot"\n' | ||
19 | features += 'MACHINE = "genericx86-64"' | ||
20 | self.append_config(features) | ||
21 | |||
22 | def _common_build(self): | ||
23 | """ | ||
24 | Common build for test cases: 1101, 1103 | ||
25 | """ | ||
26 | |||
27 | # Build a genericx86-64/efi gummiboot image | ||
28 | bitbake('syslinux syslinux-native parted-native dosfstools-native mtools-native core-image-minimal') | ||
29 | |||
30 | |||
31 | @testcase(1101) | ||
32 | def test_efi_gummiboot_images_can_be_built(self): | ||
33 | """ | ||
34 | Summary: Check if efi/gummiboot images can be built | ||
35 | Expected: 1. File gummibootx64.efi should be available in build/tmp/deploy/images/genericx86-64 | ||
36 | 2. Efi/gummiboot images can be built | ||
37 | Product: oe-core | ||
38 | Author: Ionut Chisanovici <ionutx.chisanovici@intel.com> | ||
39 | AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate@intel.com> | ||
40 | """ | ||
41 | |||
42 | # We'd use DEPLOY_DIR_IMAGE here, except that we need its value for | ||
43 | # MACHINE="genericx86-64 which is probably not the one configured | ||
44 | gummibootfile = os.path.join(get_bb_var('DEPLOY_DIR'), 'images', 'genericx86-64', 'gummibootx64.efi') | ||
45 | |||
46 | self._common_setup() | ||
47 | |||
48 | # Ensure we're actually testing that this gets built and not that | ||
49 | # it was around from an earlier build | ||
50 | bitbake('-c cleansstate gummiboot') | ||
51 | runCmd('rm -f %s' % gummibootfile) | ||
52 | |||
53 | self._common_build() | ||
54 | |||
55 | found = os.path.isfile(gummibootfile) | ||
56 | self.assertTrue(found, 'Gummiboot file %s not found' % gummibootfile) | ||
57 | |||
58 | @testcase(1103) | ||
59 | def test_wic_command_can_create_efi_gummiboot_installation_images(self): | ||
60 | """ | ||
61 | Summary: Check that wic command can create efi/gummiboot installation images | ||
62 | Expected: A .direct file in folder /var/tmp/wic/ must be created. | ||
63 | Product: oe-core | ||
64 | Author: Ionut Chisanovici <ionutx.chisanovici@intel.com> | ||
65 | AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate@intel.com> | ||
66 | """ | ||
67 | |||
68 | self._common_setup() | ||
69 | self._common_build() | ||
70 | |||
71 | # Create efi/gummiboot installation images | ||
72 | wic_create_cmd = 'wic create mkgummidisk -e core-image-minimal' | ||
73 | result = runCmd(wic_create_cmd) | ||
74 | |||
75 | # Find file written by wic from output | ||
76 | res = re.search('(/var/tmp/wic/.*\.direct)', result.output) | ||
77 | if res: | ||
78 | direct_file = res.group(1) | ||
79 | # Check it actually exists | ||
80 | if not os.path.exists(direct_file): | ||
81 | self.fail('wic reported direct file "%s" does not exist; wic output:\n%s' % (direct_file, result.output)) | ||
82 | else: | ||
83 | self.fail('No .direct file reported in wic output:\n%s' % result.output) | ||