summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorStefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>2021-12-08 11:18:39 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-12-09 10:33:25 +0000
commit5b54a2602dd9075ef5949fd914a487cb5845a2ac (patch)
tree29e8bef18565440f8f42554c6b82d3dc992987dd /meta
parentd5a8ab8b56c9d506d49c382a46a3d41c6c4a6dcd (diff)
downloadpoky-5b54a2602dd9075ef5949fd914a487cb5845a2ac.tar.gz
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>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/selftest/cases/devtool.py45
-rw-r--r--meta/lib/oeqa/selftest/cases/recipetool.py4
2 files changed, 28 insertions, 21 deletions
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index a2b4d7f7d1..23d55903fb 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -80,32 +80,15 @@ def tearDownModule():
80 bb.utils.edit_bblayers_conf(bblayers_conf, None, None, bblayers_edit_cb) 80 bb.utils.edit_bblayers_conf(bblayers_conf, None, None, bblayers_edit_cb)
81 shutil.rmtree(templayerdir) 81 shutil.rmtree(templayerdir)
82 82
83class DevtoolBase(OESelftestTestCase): 83class DevtoolTestCase(OESelftestTestCase):
84
85 @classmethod
86 def setUpClass(cls):
87 super(DevtoolBase, cls).setUpClass()
88 bb_vars = get_bb_vars(['TOPDIR', 'SSTATE_DIR'])
89 cls.original_sstate = bb_vars['SSTATE_DIR']
90 cls.devtool_sstate = os.path.join(bb_vars['TOPDIR'], 'sstate_devtool')
91 cls.sstate_conf = 'SSTATE_DIR = "%s"\n' % cls.devtool_sstate
92 cls.sstate_conf += ('SSTATE_MIRRORS += "file://.* file:///%s/PATH"\n'
93 % cls.original_sstate)
94
95 @classmethod
96 def tearDownClass(cls):
97 cls.logger.debug('Deleting devtool sstate cache on %s' % cls.devtool_sstate)
98 runCmd('rm -rf %s' % cls.devtool_sstate)
99 super(DevtoolBase, cls).tearDownClass()
100 84
101 def setUp(self): 85 def setUp(self):
102 """Test case setup function""" 86 """Test case setup function"""
103 super(DevtoolBase, self).setUp() 87 super(DevtoolTestCase, self).setUp()
104 self.workspacedir = os.path.join(self.builddir, 'workspace') 88 self.workspacedir = os.path.join(self.builddir, 'workspace')
105 self.assertTrue(not os.path.exists(self.workspacedir), 89 self.assertTrue(not os.path.exists(self.workspacedir),
106 'This test cannot be run with a workspace directory ' 90 'This test cannot be run with a workspace directory '
107 'under the build directory') 91 'under the build directory')
108 self.append_config(self.sstate_conf)
109 92
110 def _check_src_repo(self, repo_dir): 93 def _check_src_repo(self, repo_dir):
111 """Check srctree git repository""" 94 """Check srctree git repository"""
@@ -236,6 +219,30 @@ class DevtoolBase(OESelftestTestCase):
236 return filelist 219 return filelist
237 220
238 221
222class DevtoolBase(DevtoolTestCase):
223
224 @classmethod
225 def setUpClass(cls):
226 super(DevtoolBase, cls).setUpClass()
227 bb_vars = get_bb_vars(['TOPDIR', 'SSTATE_DIR'])
228 cls.original_sstate = bb_vars['SSTATE_DIR']
229 cls.devtool_sstate = os.path.join(bb_vars['TOPDIR'], 'sstate_devtool')
230 cls.sstate_conf = 'SSTATE_DIR = "%s"\n' % cls.devtool_sstate
231 cls.sstate_conf += ('SSTATE_MIRRORS += "file://.* file:///%s/PATH"\n'
232 % cls.original_sstate)
233
234 @classmethod
235 def tearDownClass(cls):
236 cls.logger.debug('Deleting devtool sstate cache on %s' % cls.devtool_sstate)
237 runCmd('rm -rf %s' % cls.devtool_sstate)
238 super(DevtoolBase, cls).tearDownClass()
239
240 def setUp(self):
241 """Test case setup function"""
242 super(DevtoolBase, self).setUp()
243 self.append_config(self.sstate_conf)
244
245
239class DevtoolTests(DevtoolBase): 246class DevtoolTests(DevtoolBase):
240 247
241 def test_create_workspace(self): 248 def test_create_workspace(self):
diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py
index 1aedc02b99..c30a0eb016 100644
--- a/meta/lib/oeqa/selftest/cases/recipetool.py
+++ b/meta/lib/oeqa/selftest/cases/recipetool.py
@@ -25,7 +25,7 @@ def tearDownModule():
25 runCmd('rm -rf %s' % templayerdir) 25 runCmd('rm -rf %s' % templayerdir)
26 26
27 27
28class RecipetoolBase(devtool.DevtoolBase): 28class RecipetoolBase(devtool.DevtoolTestCase):
29 29
30 def setUpLocal(self): 30 def setUpLocal(self):
31 super(RecipetoolBase, self).setUpLocal() 31 super(RecipetoolBase, self).setUpLocal()
@@ -72,7 +72,7 @@ class RecipetoolAppendTests(RecipetoolBase):
72 72
73 @classmethod 73 @classmethod
74 def setUpClass(cls): 74 def setUpClass(cls):
75 super(RecipetoolTests, cls).setUpClass() 75 super(RecipetoolAppendTests, cls).setUpClass()
76 # Ensure we have the right data in shlibs/pkgdata 76 # Ensure we have the right data in shlibs/pkgdata
77 cls.logger.info('Running bitbake to generate pkgdata') 77 cls.logger.info('Running bitbake to generate pkgdata')
78 bitbake('-c packagedata base-files coreutils busybox selftest-recipetool-appendfile') 78 bitbake('-c packagedata base-files coreutils busybox selftest-recipetool-appendfile')