Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit 0bfc25e

Browse files
committed
refkit_poky.py: split tests into more classes
It is useful to run signature checks separately from the slower image build tests. "bitbake -r refkit_poky" still runs both, as before, but now refkit_poky.TestRefkitPokySignatures and refkit_poky.TestRefkitPokyBuilds can be used to run those subsets of the tests. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
1 parent 450a8bf commit 0bfc25e

File tree

1 file changed

+33
-10
lines changed

1 file changed

+33
-10
lines changed

meta-refkit/lib/oeqa/selftest/cases/refkit_poky.py

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,24 @@
3131
from oeqa.selftest.case import OESelftestTestCase
3232
from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, runqemu
3333

34+
def find_layers():
35+
layers = {}
36+
result = runCmd('bitbake-layers show-layers')
37+
for layer, path, pri in re.findall(r'^(\S+) +([^\n]*?) +(\d+)$', result.output, re.MULTILINE):
38+
layers[layer] = path
39+
# meta-poky should not be active. We expect it next to the meta-refkit layer.
40+
if not 'meta-poky' in layers:
41+
layers['meta-poky'] = os.path.join(os.path.dirname(layers['meta-refkit']), 'meta-yocto', 'meta-poky')
42+
return layers
43+
44+
class RefkitLayers():
45+
"""
46+
Locates existing layers as part of the class construction. Useful for
47+
sharing that information across different other classes.
48+
"""
49+
50+
layers = find_layers()
51+
3452
class RefkitPokyMeta(type):
3553
"""
3654
Generates different instances of test_compat_meta_<layer> for each refkit layer.
@@ -77,20 +95,12 @@ def test(self):
7795
self.logger.info('%s:\n%s' % (cmd, result.output))
7896
return test
7997

80-
layers = {}
81-
result = runCmd('bitbake-layers show-layers')
82-
for layer, path, pri in re.findall(r'^(\S+) +([^\n]*?) +(\d+)$', result.output, re.MULTILINE):
83-
layers[layer] = path
84-
# meta-poky should not be active. We expect it next to the meta-refkit layer.
85-
if not 'meta-poky' in layers:
86-
layers['meta-poky'] = os.path.join(os.path.dirname(layers['meta-refkit']), 'meta-yocto', 'meta-poky')
87-
dict['layers'] = layers
88-
for refkit_layer in [x for x in layers.keys() if x.startswith('meta-refkit')]:
98+
for refkit_layer in [x for x in RefkitLayers.layers.keys() if x.startswith('meta-refkit')]:
8999
test_name = 'test_compat_%s' % refkit_layer.replace('-', '_')
90100
dict[test_name] = gen_test(refkit_layer)
91101
return type.__new__(mcs, name, bases, dict)
92102

93-
class TestRefkitPoky(OESelftestTestCase, metaclass=RefkitPokyMeta):
103+
class TestRefkitPokyBase(OESelftestTestCase, RefkitLayers):
94104
"""
95105
Tests content from refkit against Poky. We do not want to depend on the
96106
combined poky repo, though, so Poky in this context is OE-core + meta-poky.
@@ -203,6 +213,13 @@ def add_refkit_layers(self):
203213
"""Add all layers also active in the parent refkit build dir."""
204214
self.append_bblayers_config('BBLAYERS += "%s"' % (' '.join([self.layers[x] for x in self.layers.keys() if x not in self.poky_layers])))
205215

216+
217+
class TestRefkitPokySignatures(TestRefkitPokyBase, metaclass=RefkitPokyMeta):
218+
"""
219+
Test that signatures are not changed. Most of the tests are generated
220+
dynamically by RefkitPokyMeta.
221+
"""
222+
206223
def test_refkit_conf_signature(self):
207224
"""Ensure that including the refkit config does not change the signature of other layers."""
208225
old_path = sys.path
@@ -223,6 +240,12 @@ def test_refkit_conf_signature(self):
223240
finally:
224241
sys.path = old_path
225242

243+
244+
class TestRefkitPokyBuilds(TestRefkitPokyBase):
245+
"""
246+
Test actual image building with Poky as base distribution.
247+
"""
248+
226249
def test_common_poky_config(self):
227250
"""
228251
A full image build test of the common image,

0 commit comments

Comments
 (0)