diff options
author | Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> | 2017-05-12 14:40:21 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-06-06 19:02:43 +0100 |
commit | 157c3be2ca93f076033f725ec1ee912df91f7488 (patch) | |
tree | 8ef896ff7adf78d63b34059cd5b017a4f0a3419a /meta/lib/oeqa/selftest/cases/bblayers.py | |
parent | 10c512b60d1167122b5fe778b93838dca3def717 (diff) | |
download | poky-157c3be2ca93f076033f725ec1ee912df91f7488.tar.gz |
oeqa/selftest/cases: Migrate test cases into the new oe-qa framework
New framework has different classes/decorators so adapt current test cases to
support these. Changes include changes on base classes and decorators.
Also include paths in selftest/__init__.py isn't needed because the
loader is the standard unittest one.
(From OE-Core rev: ddbbefdd124604d10bd47dd0266b55a764fcc0ab)
Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/bblayers.py')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/bblayers.py | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/bblayers.py b/meta/lib/oeqa/selftest/cases/bblayers.py new file mode 100644 index 0000000000..90a2249b08 --- /dev/null +++ b/meta/lib/oeqa/selftest/cases/bblayers.py | |||
@@ -0,0 +1,97 @@ | |||
1 | import os | ||
2 | import re | ||
3 | |||
4 | import oeqa.utils.ftools as ftools | ||
5 | from oeqa.utils.commands import runCmd, get_bb_var | ||
6 | |||
7 | from oeqa.selftest.case import OESelftestTestCase | ||
8 | from oeqa.core.decorator.oeid import OETestID | ||
9 | |||
10 | class BitbakeLayers(OESelftestTestCase): | ||
11 | |||
12 | @OETestID(756) | ||
13 | def test_bitbakelayers_showcrossdepends(self): | ||
14 | result = runCmd('bitbake-layers show-cross-depends') | ||
15 | self.assertTrue('aspell' in result.output, msg = "No dependencies were shown. bitbake-layers show-cross-depends output: %s" % result.output) | ||
16 | |||
17 | @OETestID(83) | ||
18 | def test_bitbakelayers_showlayers(self): | ||
19 | result = runCmd('bitbake-layers show-layers') | ||
20 | self.assertTrue('meta-selftest' in result.output, msg = "No layers were shown. bitbake-layers show-layers output: %s" % result.output) | ||
21 | |||
22 | @OETestID(93) | ||
23 | def test_bitbakelayers_showappends(self): | ||
24 | recipe = "xcursor-transparent-theme" | ||
25 | bb_file = self.get_recipe_basename(recipe) | ||
26 | result = runCmd('bitbake-layers show-appends') | ||
27 | self.assertTrue(bb_file in result.output, msg="%s file was not recognised. bitbake-layers show-appends output: %s" % (bb_file, result.output)) | ||
28 | |||
29 | @OETestID(90) | ||
30 | def test_bitbakelayers_showoverlayed(self): | ||
31 | result = runCmd('bitbake-layers show-overlayed') | ||
32 | self.assertTrue('aspell' in result.output, msg="aspell overlayed recipe was not recognised bitbake-layers show-overlayed %s" % result.output) | ||
33 | |||
34 | @OETestID(95) | ||
35 | def test_bitbakelayers_flatten(self): | ||
36 | recipe = "xcursor-transparent-theme" | ||
37 | recipe_path = "recipes-graphics/xcursor-transparent-theme" | ||
38 | recipe_file = self.get_recipe_basename(recipe) | ||
39 | testoutdir = os.path.join(self.builddir, 'test_bitbakelayers_flatten') | ||
40 | self.assertFalse(os.path.isdir(testoutdir), msg = "test_bitbakelayers_flatten should not exist at this point in time") | ||
41 | self.track_for_cleanup(testoutdir) | ||
42 | result = runCmd('bitbake-layers flatten %s' % testoutdir) | ||
43 | bb_file = os.path.join(testoutdir, recipe_path, recipe_file) | ||
44 | self.assertTrue(os.path.isfile(bb_file), msg = "Cannot find xcursor-transparent-theme_0.1.1.bb in the test_bitbakelayers_flatten local dir.") | ||
45 | contents = ftools.read_file(bb_file) | ||
46 | find_in_contents = re.search("##### bbappended from meta-selftest #####\n(.*\n)*include test_recipe.inc", contents) | ||
47 | self.assertTrue(find_in_contents, msg = "Flattening layers did not work. bitbake-layers flatten output: %s" % result.output) | ||
48 | |||
49 | @OETestID(1195) | ||
50 | def test_bitbakelayers_add_remove(self): | ||
51 | test_layer = os.path.join(get_bb_var('COREBASE'), 'meta-skeleton') | ||
52 | result = runCmd('bitbake-layers show-layers') | ||
53 | self.assertNotIn('meta-skeleton', result.output, "This test cannot run with meta-skeleton in bblayers.conf. bitbake-layers show-layers output: %s" % result.output) | ||
54 | result = runCmd('bitbake-layers add-layer %s' % test_layer) | ||
55 | result = runCmd('bitbake-layers show-layers') | ||
56 | self.assertIn('meta-skeleton', result.output, msg = "Something wrong happened. meta-skeleton layer was not added to conf/bblayers.conf. bitbake-layers show-layers output: %s" % result.output) | ||
57 | result = runCmd('bitbake-layers remove-layer %s' % test_layer) | ||
58 | result = runCmd('bitbake-layers show-layers') | ||
59 | self.assertNotIn('meta-skeleton', result.output, msg = "meta-skeleton should have been removed at this step. bitbake-layers show-layers output: %s" % result.output) | ||
60 | result = runCmd('bitbake-layers add-layer %s' % test_layer) | ||
61 | result = runCmd('bitbake-layers show-layers') | ||
62 | self.assertIn('meta-skeleton', result.output, msg = "Something wrong happened. meta-skeleton layer was not added to conf/bblayers.conf. bitbake-layers show-layers output: %s" % result.output) | ||
63 | result = runCmd('bitbake-layers remove-layer */meta-skeleton') | ||
64 | result = runCmd('bitbake-layers show-layers') | ||
65 | self.assertNotIn('meta-skeleton', result.output, msg = "meta-skeleton should have been removed at this step. bitbake-layers show-layers output: %s" % result.output) | ||
66 | |||
67 | @OETestID(1384) | ||
68 | def test_bitbakelayers_showrecipes(self): | ||
69 | result = runCmd('bitbake-layers show-recipes') | ||
70 | self.assertIn('aspell:', result.output) | ||
71 | self.assertIn('mtd-utils:', result.output) | ||
72 | self.assertIn('core-image-minimal:', result.output) | ||
73 | result = runCmd('bitbake-layers show-recipes mtd-utils') | ||
74 | self.assertIn('mtd-utils:', result.output) | ||
75 | self.assertNotIn('aspell:', result.output) | ||
76 | result = runCmd('bitbake-layers show-recipes -i image') | ||
77 | self.assertIn('core-image-minimal', result.output) | ||
78 | self.assertNotIn('mtd-utils:', result.output) | ||
79 | result = runCmd('bitbake-layers show-recipes -i cmake,pkgconfig') | ||
80 | self.assertIn('libproxy:', result.output) | ||
81 | self.assertNotIn('mtd-utils:', result.output) # doesn't inherit either | ||
82 | self.assertNotIn('wget:', result.output) # doesn't inherit cmake | ||
83 | self.assertNotIn('waffle:', result.output) # doesn't inherit pkgconfig | ||
84 | result = runCmd('bitbake-layers show-recipes -i nonexistentclass', ignore_status=True) | ||
85 | self.assertNotEqual(result.status, 0, 'bitbake-layers show-recipes -i nonexistentclass should have failed') | ||
86 | self.assertIn('ERROR:', result.output) | ||
87 | |||
88 | def get_recipe_basename(self, recipe): | ||
89 | recipe_file = "" | ||
90 | result = runCmd("bitbake-layers show-recipes -f %s" % recipe) | ||
91 | for line in result.output.splitlines(): | ||
92 | if recipe in line: | ||
93 | recipe_file = line | ||
94 | break | ||
95 | |||
96 | self.assertTrue(os.path.isfile(recipe_file), msg = "Can't find recipe file for %s" % recipe) | ||
97 | return os.path.basename(recipe_file) | ||