summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/cases/bblayers.py
diff options
context:
space:
mode:
authorJoshua Watt <jpewhacker@gmail.com>2018-06-30 11:16:37 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-07-02 21:37:47 +0100
commit9086a55d25c4c45ae3be3a4239a487f2df1a2e98 (patch)
tree66d1b991429c19f6bc386f4e085ca09c6e54334d /meta/lib/oeqa/selftest/cases/bblayers.py
parent058119da17c3ceb35d5b9f106f410320bdf3986b (diff)
downloadpoky-9086a55d25c4c45ae3be3a4239a487f2df1a2e98.tar.gz
oe-selftest: Add bitbake-layer create-layer test
Adds a test that creates a layer, adds it to bblayers.conf, then ensure that it appears properly in bitbake-layers show-layers. (From OE-Core rev: 828462d2c39fe6f4d188b5eb129f7b2969e1ee18) Signed-off-by: Joshua Watt <JPEWhacker@gmail.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.py27
1 files changed, 26 insertions, 1 deletions
diff --git a/meta/lib/oeqa/selftest/cases/bblayers.py b/meta/lib/oeqa/selftest/cases/bblayers.py
index 90a2249b08..3448ae1999 100644
--- a/meta/lib/oeqa/selftest/cases/bblayers.py
+++ b/meta/lib/oeqa/selftest/cases/bblayers.py
@@ -2,7 +2,7 @@ import os
2import re 2import re
3 3
4import oeqa.utils.ftools as ftools 4import oeqa.utils.ftools as ftools
5from oeqa.utils.commands import runCmd, get_bb_var 5from oeqa.utils.commands import runCmd, get_bb_var, get_bb_vars
6 6
7from oeqa.selftest.case import OESelftestTestCase 7from oeqa.selftest.case import OESelftestTestCase
8from oeqa.core.decorator.oeid import OETestID 8from oeqa.core.decorator.oeid import OETestID
@@ -85,6 +85,31 @@ class BitbakeLayers(OESelftestTestCase):
85 self.assertNotEqual(result.status, 0, 'bitbake-layers show-recipes -i nonexistentclass should have failed') 85 self.assertNotEqual(result.status, 0, 'bitbake-layers show-recipes -i nonexistentclass should have failed')
86 self.assertIn('ERROR:', result.output) 86 self.assertIn('ERROR:', result.output)
87 87
88 def test_bitbakelayers_createlayer(self):
89 priority = 10
90 layername = 'test-bitbakelayer-layercreate'
91 layerpath = os.path.join(get_bb_var('COREBASE'), layername)
92 self.assertFalse(os.path.exists(layerpath), '%s should not exist at this point in time' % layerpath)
93 result = runCmd('bitbake-layers create-layer --priority=%d %s' % (priority, layerpath))
94 self.track_for_cleanup(layerpath)
95 result = runCmd('bitbake-layers add-layer %s' % layerpath)
96 self.add_command_to_tearDown('bitbake-layers remove-layer %s' % layerpath)
97 result = runCmd('bitbake-layers show-layers')
98 find_in_contents = re.search(re.escape(layername) + r'\s+' + re.escape(layerpath) + r'\s+' + re.escape(str(priority)), result.output)
99 self.assertTrue(find_in_contents, "%s not found in layers\n%s" % (layername, result.output))
100
101 layervars = ['BBFILE_PRIORITY', 'BBFILE_PATTERN', 'LAYERDEPENDS', 'LAYERSERIES_COMPAT']
102 bb_vars = get_bb_vars(['BBFILE_COLLECTIONS'] + ['%s_%s' % (v, layername) for v in layervars])
103
104 for v in layervars:
105 varname = '%s_%s' % (v, layername)
106 self.assertIsNotNone(bb_vars[varname], "%s not found" % varname)
107
108 find_in_contents = re.search(r'(^|\s)' + re.escape(layername) + r'($|\s)', bb_vars['BBFILE_COLLECTIONS'])
109 self.assertTrue(find_in_contents, "%s not in BBFILE_COLLECTIONS" % layername)
110
111 self.assertEqual(bb_vars['BBFILE_PRIORITY_%s' % layername], str(priority), 'BBFILE_PRIORITY_%s != %d' % (layername, priority))
112
88 def get_recipe_basename(self, recipe): 113 def get_recipe_basename(self, recipe):
89 recipe_file = "" 114 recipe_file = ""
90 result = runCmd("bitbake-layers show-recipes -f %s" % recipe) 115 result = runCmd("bitbake-layers show-recipes -f %s" % recipe)