mirror of
https://git.yoctoproject.org/poky
synced 2026-06-02 13:29:49 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
058119da17
commit
9086a55d25
@@ -2,7 +2,7 @@ import os
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
import oeqa.utils.ftools as ftools
|
import oeqa.utils.ftools as ftools
|
||||||
from oeqa.utils.commands import runCmd, get_bb_var
|
from oeqa.utils.commands import runCmd, get_bb_var, get_bb_vars
|
||||||
|
|
||||||
from oeqa.selftest.case import OESelftestTestCase
|
from oeqa.selftest.case import OESelftestTestCase
|
||||||
from oeqa.core.decorator.oeid import OETestID
|
from oeqa.core.decorator.oeid import OETestID
|
||||||
@@ -85,6 +85,31 @@ class BitbakeLayers(OESelftestTestCase):
|
|||||||
self.assertNotEqual(result.status, 0, 'bitbake-layers show-recipes -i nonexistentclass should have failed')
|
self.assertNotEqual(result.status, 0, 'bitbake-layers show-recipes -i nonexistentclass should have failed')
|
||||||
self.assertIn('ERROR:', result.output)
|
self.assertIn('ERROR:', result.output)
|
||||||
|
|
||||||
|
def test_bitbakelayers_createlayer(self):
|
||||||
|
priority = 10
|
||||||
|
layername = 'test-bitbakelayer-layercreate'
|
||||||
|
layerpath = os.path.join(get_bb_var('COREBASE'), layername)
|
||||||
|
self.assertFalse(os.path.exists(layerpath), '%s should not exist at this point in time' % layerpath)
|
||||||
|
result = runCmd('bitbake-layers create-layer --priority=%d %s' % (priority, layerpath))
|
||||||
|
self.track_for_cleanup(layerpath)
|
||||||
|
result = runCmd('bitbake-layers add-layer %s' % layerpath)
|
||||||
|
self.add_command_to_tearDown('bitbake-layers remove-layer %s' % layerpath)
|
||||||
|
result = runCmd('bitbake-layers show-layers')
|
||||||
|
find_in_contents = re.search(re.escape(layername) + r'\s+' + re.escape(layerpath) + r'\s+' + re.escape(str(priority)), result.output)
|
||||||
|
self.assertTrue(find_in_contents, "%s not found in layers\n%s" % (layername, result.output))
|
||||||
|
|
||||||
|
layervars = ['BBFILE_PRIORITY', 'BBFILE_PATTERN', 'LAYERDEPENDS', 'LAYERSERIES_COMPAT']
|
||||||
|
bb_vars = get_bb_vars(['BBFILE_COLLECTIONS'] + ['%s_%s' % (v, layername) for v in layervars])
|
||||||
|
|
||||||
|
for v in layervars:
|
||||||
|
varname = '%s_%s' % (v, layername)
|
||||||
|
self.assertIsNotNone(bb_vars[varname], "%s not found" % varname)
|
||||||
|
|
||||||
|
find_in_contents = re.search(r'(^|\s)' + re.escape(layername) + r'($|\s)', bb_vars['BBFILE_COLLECTIONS'])
|
||||||
|
self.assertTrue(find_in_contents, "%s not in BBFILE_COLLECTIONS" % layername)
|
||||||
|
|
||||||
|
self.assertEqual(bb_vars['BBFILE_PRIORITY_%s' % layername], str(priority), 'BBFILE_PRIORITY_%s != %d' % (layername, priority))
|
||||||
|
|
||||||
def get_recipe_basename(self, recipe):
|
def get_recipe_basename(self, recipe):
|
||||||
recipe_file = ""
|
recipe_file = ""
|
||||||
result = runCmd("bitbake-layers show-recipes -f %s" % recipe)
|
result = runCmd("bitbake-layers show-recipes -f %s" % recipe)
|
||||||
|
|||||||
Reference in New Issue
Block a user