mirror of
https://git.yoctoproject.org/poky
synced 2026-04-21 03:32:12 +02:00
selftest: devtool: Separate common functions and devtool sstate setup into two classes
The selftest recipetool base class reuse the selftest devtool base class. Thereby the selftest devtool base class setup its own devtool sstate and the selftest recipetool classes trigger the build of recipes. This leads to the problem that the build artifacts doesn't reach the persistent sstate cache and rebuild on every selftest run. Move the common selftest devtool functions into its own class and use the sstate cache in the recipetool tests. (From OE-Core rev: c0bd0686092181b6a5316c373b5b125d78a24e9f) Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
d5a8ab8b56
commit
5b54a2602d
@@ -80,32 +80,15 @@ def tearDownModule():
|
||||
bb.utils.edit_bblayers_conf(bblayers_conf, None, None, bblayers_edit_cb)
|
||||
shutil.rmtree(templayerdir)
|
||||
|
||||
class DevtoolBase(OESelftestTestCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(DevtoolBase, cls).setUpClass()
|
||||
bb_vars = get_bb_vars(['TOPDIR', 'SSTATE_DIR'])
|
||||
cls.original_sstate = bb_vars['SSTATE_DIR']
|
||||
cls.devtool_sstate = os.path.join(bb_vars['TOPDIR'], 'sstate_devtool')
|
||||
cls.sstate_conf = 'SSTATE_DIR = "%s"\n' % cls.devtool_sstate
|
||||
cls.sstate_conf += ('SSTATE_MIRRORS += "file://.* file:///%s/PATH"\n'
|
||||
% cls.original_sstate)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
cls.logger.debug('Deleting devtool sstate cache on %s' % cls.devtool_sstate)
|
||||
runCmd('rm -rf %s' % cls.devtool_sstate)
|
||||
super(DevtoolBase, cls).tearDownClass()
|
||||
class DevtoolTestCase(OESelftestTestCase):
|
||||
|
||||
def setUp(self):
|
||||
"""Test case setup function"""
|
||||
super(DevtoolBase, self).setUp()
|
||||
super(DevtoolTestCase, self).setUp()
|
||||
self.workspacedir = os.path.join(self.builddir, 'workspace')
|
||||
self.assertTrue(not os.path.exists(self.workspacedir),
|
||||
'This test cannot be run with a workspace directory '
|
||||
'under the build directory')
|
||||
self.append_config(self.sstate_conf)
|
||||
|
||||
def _check_src_repo(self, repo_dir):
|
||||
"""Check srctree git repository"""
|
||||
@@ -236,6 +219,30 @@ class DevtoolBase(OESelftestTestCase):
|
||||
return filelist
|
||||
|
||||
|
||||
class DevtoolBase(DevtoolTestCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(DevtoolBase, cls).setUpClass()
|
||||
bb_vars = get_bb_vars(['TOPDIR', 'SSTATE_DIR'])
|
||||
cls.original_sstate = bb_vars['SSTATE_DIR']
|
||||
cls.devtool_sstate = os.path.join(bb_vars['TOPDIR'], 'sstate_devtool')
|
||||
cls.sstate_conf = 'SSTATE_DIR = "%s"\n' % cls.devtool_sstate
|
||||
cls.sstate_conf += ('SSTATE_MIRRORS += "file://.* file:///%s/PATH"\n'
|
||||
% cls.original_sstate)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
cls.logger.debug('Deleting devtool sstate cache on %s' % cls.devtool_sstate)
|
||||
runCmd('rm -rf %s' % cls.devtool_sstate)
|
||||
super(DevtoolBase, cls).tearDownClass()
|
||||
|
||||
def setUp(self):
|
||||
"""Test case setup function"""
|
||||
super(DevtoolBase, self).setUp()
|
||||
self.append_config(self.sstate_conf)
|
||||
|
||||
|
||||
class DevtoolTests(DevtoolBase):
|
||||
|
||||
def test_create_workspace(self):
|
||||
|
||||
@@ -25,7 +25,7 @@ def tearDownModule():
|
||||
runCmd('rm -rf %s' % templayerdir)
|
||||
|
||||
|
||||
class RecipetoolBase(devtool.DevtoolBase):
|
||||
class RecipetoolBase(devtool.DevtoolTestCase):
|
||||
|
||||
def setUpLocal(self):
|
||||
super(RecipetoolBase, self).setUpLocal()
|
||||
@@ -72,7 +72,7 @@ class RecipetoolAppendTests(RecipetoolBase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(RecipetoolTests, cls).setUpClass()
|
||||
super(RecipetoolAppendTests, cls).setUpClass()
|
||||
# Ensure we have the right data in shlibs/pkgdata
|
||||
cls.logger.info('Running bitbake to generate pkgdata')
|
||||
bitbake('-c packagedata base-files coreutils busybox selftest-recipetool-appendfile')
|
||||
|
||||
Reference in New Issue
Block a user