31
31
from oeqa .selftest .case import OESelftestTestCase
32
32
from oeqa .utils .commands import runCmd , bitbake , get_bb_var , get_bb_vars , runqemu
33
33
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
+
34
52
class RefkitPokyMeta (type ):
35
53
"""
36
54
Generates different instances of test_compat_meta_<layer> for each refkit layer.
@@ -77,20 +95,12 @@ def test(self):
77
95
self .logger .info ('%s:\n %s' % (cmd , result .output ))
78
96
return test
79
97
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' )]:
89
99
test_name = 'test_compat_%s' % refkit_layer .replace ('-' , '_' )
90
100
dict [test_name ] = gen_test (refkit_layer )
91
101
return type .__new__ (mcs , name , bases , dict )
92
102
93
- class TestRefkitPoky (OESelftestTestCase , metaclass = RefkitPokyMeta ):
103
+ class TestRefkitPokyBase (OESelftestTestCase , RefkitLayers ):
94
104
"""
95
105
Tests content from refkit against Poky. We do not want to depend on the
96
106
combined poky repo, though, so Poky in this context is OE-core + meta-poky.
@@ -203,6 +213,13 @@ def add_refkit_layers(self):
203
213
"""Add all layers also active in the parent refkit build dir."""
204
214
self .append_bblayers_config ('BBLAYERS += "%s"' % (' ' .join ([self .layers [x ] for x in self .layers .keys () if x not in self .poky_layers ])))
205
215
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
+
206
223
def test_refkit_conf_signature (self ):
207
224
"""Ensure that including the refkit config does not change the signature of other layers."""
208
225
old_path = sys .path
@@ -223,6 +240,12 @@ def test_refkit_conf_signature(self):
223
240
finally :
224
241
sys .path = old_path
225
242
243
+
244
+ class TestRefkitPokyBuilds (TestRefkitPokyBase ):
245
+ """
246
+ Test actual image building with Poky as base distribution.
247
+ """
248
+
226
249
def test_common_poky_config (self ):
227
250
"""
228
251
A full image build test of the common image,
0 commit comments