summaryrefslogtreecommitdiffstats
path: root/scripts/lib/checklayer/cases/common.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2017-09-19 15:57:07 +1200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-09-21 11:34:19 +0100
commitb32174e58e89119e3ca2315030629a6580ccbd52 (patch)
tree1be70a32209bd098988f1d60cd7ce496329129d0 /scripts/lib/checklayer/cases/common.py
parent455877548e7a685f0dacf3b10056ff85c7aeedf2 (diff)
downloadpoky-b32174e58e89119e3ca2315030629a6580ccbd52.tar.gz
scripts: rename yocto-compat-layer to remove "compatible" nomenclature
"Yocto Project Compatible" [1] is a programme which requires you meet specific criteria including going through an application process - it is not sufficient simply to run the script we have created here and have it produce no warnings/errors. To avoid people being confused by the fact that this script uses the term "compatible" or variations thereof, substitute usage of that word with "check" instead. The functionality of the script is unchanged. [1] https://www.yoctoproject.org/ecosystem/yocto-project-branding-program (From OE-Core rev: 2a6126a115f10750ea89f95629d3699ad41c5665) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/checklayer/cases/common.py')
-rw-r--r--scripts/lib/checklayer/cases/common.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/scripts/lib/checklayer/cases/common.py b/scripts/lib/checklayer/cases/common.py
new file mode 100644
index 0000000000..a13c1088f0
--- /dev/null
+++ b/scripts/lib/checklayer/cases/common.py
@@ -0,0 +1,53 @@
1# Copyright (C) 2017 Intel Corporation
2# Released under the MIT license (see COPYING.MIT)
3
4import glob
5import os
6import unittest
7from checklayer import get_signatures, LayerType, check_command, get_depgraph, compare_signatures
8from checklayer.case import OECheckLayerTestCase
9
10class CommonCheckLayer(OECheckLayerTestCase):
11 def test_readme(self):
12 # The top-level README file may have a suffix (like README.rst or README.txt).
13 readme_files = glob.glob(os.path.join(self.tc.layer['path'], 'README*'))
14 self.assertTrue(len(readme_files) > 0,
15 msg="Layer doesn't contains README file.")
16
17 # There might be more than one file matching the file pattern above
18 # (for example, README.rst and README-COPYING.rst). The one with the shortest
19 # name is considered the "main" one.
20 readme_file = sorted(readme_files)[0]
21 data = ''
22 with open(readme_file, 'r') as f:
23 data = f.read()
24 self.assertTrue(data,
25 msg="Layer contains a README file but it is empty.")
26
27 def test_parse(self):
28 check_command('Layer %s failed to parse.' % self.tc.layer['name'],
29 'bitbake -p')
30
31 def test_show_environment(self):
32 check_command('Layer %s failed to show environment.' % self.tc.layer['name'],
33 'bitbake -e')
34
35 def test_world(self):
36 '''
37 "bitbake world" is expected to work. test_signatures does not cover that
38 because it is more lenient and ignores recipes in a world build that
39 are not actually buildable, so here we fail when "bitbake -S none world"
40 fails.
41 '''
42 get_signatures(self.td['builddir'], failsafe=False)
43
44 def test_signatures(self):
45 if self.tc.layer['type'] == LayerType.SOFTWARE and \
46 not self.tc.test_software_layer_signatures:
47 raise unittest.SkipTest("Not testing for signature changes in a software layer %s." \
48 % self.tc.layer['name'])
49
50 curr_sigs, _ = get_signatures(self.td['builddir'], failsafe=True)
51 msg = compare_signatures(self.td['sigs'], curr_sigs)
52 if msg is not None:
53 self.fail('Adding layer %s changed signatures.\n%s' % (self.tc.layer['name'], msg))