blob: 20c17e46fb140c4e778aef765a93f5ea1ad1040c [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001import unittest
2import os
3import logging
4import re
5import shutil
6
7import oeqa.utils.ftools as ftools
8from oeqa.selftest.base import oeSelfTest
9from oeqa.utils.commands import runCmd, get_bb_var
10from oeqa.utils.decorators import testcase
11
12class BitbakeLayers(oeSelfTest):
13
14 @testcase(756)
15 def test_bitbakelayers_showcrossdepends(self):
16 result = runCmd('bitbake-layers show-cross-depends')
17 self.assertTrue('aspell' in result.output, msg = "No dependencies were shown. bitbake-layers show-cross-depends output: %s" % result.output)
18
19 @testcase(83)
20 def test_bitbakelayers_showlayers(self):
21 result = runCmd('bitbake-layers show-layers')
22 self.assertTrue('meta-selftest' in result.output, msg = "No layers were shown. bitbake-layers show-layers output: %s" % result.output)
23
24 @testcase(93)
25 def test_bitbakelayers_showappends(self):
26 result = runCmd('bitbake-layers show-appends')
27 self.assertTrue('xcursor-transparent-theme_0.1.1.bbappend' in result.output, msg="xcursor-transparent-theme_0.1.1.bbappend file was not recognised. bitbake-layers show-appends output: %s" % result.output)
28
29 @testcase(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 @testcase(95)
35 def test_bitbakelayers_flatten(self):
36 testoutdir = os.path.join(self.builddir, 'test_bitbakelayers_flatten')
37 self.assertFalse(os.path.isdir(testoutdir), msg = "test_bitbakelayers_flatten should not exist at this point in time")
38 self.track_for_cleanup(testoutdir)
39 result = runCmd('bitbake-layers flatten %s' % testoutdir)
40 bb_file = os.path.join(testoutdir, 'recipes-graphics/xcursor-transparent-theme/xcursor-transparent-theme_0.1.1.bb')
41 self.assertTrue(os.path.isfile(bb_file), msg = "Cannot find xcursor-transparent-theme_0.1.1.bb in the test_bitbakelayers_flatten local dir.")
42 contents = ftools.read_file(bb_file)
43 find_in_contents = re.search("##### bbappended from meta-selftest #####\n(.*\n)*include test_recipe.inc", contents)
44 self.assertTrue(find_in_contents, msg = "Flattening layers did not work. bitbake-layers flatten output: %s" % result.output)
45
46 @testcase(1195)
47 def test_bitbakelayers_add_remove(self):
48 test_layer = os.path.join(get_bb_var('COREBASE'), 'meta-skeleton')
49 result = runCmd('bitbake-layers show-layers')
50 self.assertNotIn('meta-skeleton', result.output, "This test cannot run with meta-skeleton in bblayers.conf. bitbake-layers show-layers output: %s" % result.output)
51 result = runCmd('bitbake-layers add-layer %s' % test_layer)
52 result = runCmd('bitbake-layers show-layers')
53 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)
54 result = runCmd('bitbake-layers remove-layer %s' % test_layer)
55 result = runCmd('bitbake-layers show-layers')
56 self.assertNotIn('meta-skeleton', result.output, msg = "meta-skeleton should have been removed at this step. bitbake-layers show-layers output: %s" % result.output)
57 result = runCmd('bitbake-layers add-layer %s' % test_layer)
58 result = runCmd('bitbake-layers show-layers')
59 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)
60 result = runCmd('bitbake-layers remove-layer */meta-skeleton')
61 result = runCmd('bitbake-layers show-layers')
62 self.assertNotIn('meta-skeleton', result.output, msg = "meta-skeleton should have been removed at this step. bitbake-layers show-layers output: %s" % result.output)