summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/cases/archiver.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/archiver.py')
-rw-r--r--meta/lib/oeqa/selftest/cases/archiver.py68
1 files changed, 51 insertions, 17 deletions
diff --git a/meta/lib/oeqa/selftest/cases/archiver.py b/meta/lib/oeqa/selftest/cases/archiver.py
index ddd08ecf84..612ec675a7 100644
--- a/meta/lib/oeqa/selftest/cases/archiver.py
+++ b/meta/lib/oeqa/selftest/cases/archiver.py
@@ -1,9 +1,12 @@
1# 1#
2# Copyright OpenEmbedded Contributors
3#
2# SPDX-License-Identifier: MIT 4# SPDX-License-Identifier: MIT
3# 5#
4 6
5import os 7import os
6import glob 8import glob
9import re
7from oeqa.utils.commands import bitbake, get_bb_vars 10from oeqa.utils.commands import bitbake, get_bb_vars
8from oeqa.selftest.case import OESelftestTestCase 11from oeqa.selftest.case import OESelftestTestCase
9 12
@@ -35,11 +38,11 @@ class Archiver(OESelftestTestCase):
35 src_path = os.path.join(bb_vars['DEPLOY_DIR_SRC'], bb_vars['TARGET_SYS']) 38 src_path = os.path.join(bb_vars['DEPLOY_DIR_SRC'], bb_vars['TARGET_SYS'])
36 39
37 # Check that include_recipe was included 40 # Check that include_recipe was included
38 included_present = len(glob.glob(src_path + '/%s-*' % include_recipe)) 41 included_present = len(glob.glob(src_path + '/%s-*/*' % include_recipe))
39 self.assertTrue(included_present, 'Recipe %s was not included.' % include_recipe) 42 self.assertTrue(included_present, 'Recipe %s was not included.' % include_recipe)
40 43
41 # Check that exclude_recipe was excluded 44 # Check that exclude_recipe was excluded
42 excluded_present = len(glob.glob(src_path + '/%s-*' % exclude_recipe)) 45 excluded_present = len(glob.glob(src_path + '/%s-*/*' % exclude_recipe))
43 self.assertFalse(excluded_present, 'Recipe %s was not excluded.' % exclude_recipe) 46 self.assertFalse(excluded_present, 'Recipe %s was not excluded.' % exclude_recipe)
44 47
45 def test_archiver_filters_by_type(self): 48 def test_archiver_filters_by_type(self):
@@ -67,11 +70,11 @@ class Archiver(OESelftestTestCase):
67 src_path_native = os.path.join(bb_vars['DEPLOY_DIR_SRC'], bb_vars['BUILD_SYS']) 70 src_path_native = os.path.join(bb_vars['DEPLOY_DIR_SRC'], bb_vars['BUILD_SYS'])
68 71
69 # Check that target_recipe was included 72 # Check that target_recipe was included
70 included_present = len(glob.glob(src_path_target + '/%s-*' % target_recipe)) 73 included_present = len(glob.glob(src_path_target + '/%s-*/*' % target_recipe))
71 self.assertTrue(included_present, 'Recipe %s was not included.' % target_recipe) 74 self.assertTrue(included_present, 'Recipe %s was not included.' % target_recipe)
72 75
73 # Check that native_recipe was excluded 76 # Check that native_recipe was excluded
74 excluded_present = len(glob.glob(src_path_native + '/%s-*' % native_recipe)) 77 excluded_present = len(glob.glob(src_path_native + '/%s-*/*' % native_recipe))
75 self.assertFalse(excluded_present, 'Recipe %s was not excluded.' % native_recipe) 78 self.assertFalse(excluded_present, 'Recipe %s was not excluded.' % native_recipe)
76 79
77 def test_archiver_filters_by_type_and_name(self): 80 def test_archiver_filters_by_type_and_name(self):
@@ -104,20 +107,51 @@ class Archiver(OESelftestTestCase):
104 src_path_native = os.path.join(bb_vars['DEPLOY_DIR_SRC'], bb_vars['BUILD_SYS']) 107 src_path_native = os.path.join(bb_vars['DEPLOY_DIR_SRC'], bb_vars['BUILD_SYS'])
105 108
106 # Check that target_recipe[0] and native_recipes[1] were included 109 # Check that target_recipe[0] and native_recipes[1] were included
107 included_present = len(glob.glob(src_path_target + '/%s-*' % target_recipes[0])) 110 included_present = len(glob.glob(src_path_target + '/%s-*/*' % target_recipes[0]))
108 self.assertTrue(included_present, 'Recipe %s was not included.' % target_recipes[0]) 111 self.assertTrue(included_present, 'Recipe %s was not included.' % target_recipes[0])
109 112
110 included_present = len(glob.glob(src_path_native + '/%s-*' % native_recipes[1])) 113 included_present = len(glob.glob(src_path_native + '/%s-*/*' % native_recipes[1]))
111 self.assertTrue(included_present, 'Recipe %s was not included.' % native_recipes[1]) 114 self.assertTrue(included_present, 'Recipe %s was not included.' % native_recipes[1])
112 115
113 # Check that native_recipes[0] and target_recipes[1] were excluded 116 # Check that native_recipes[0] and target_recipes[1] were excluded
114 excluded_present = len(glob.glob(src_path_native + '/%s-*' % native_recipes[0])) 117 excluded_present = len(glob.glob(src_path_native + '/%s-*/*' % native_recipes[0]))
115 self.assertFalse(excluded_present, 'Recipe %s was not excluded.' % native_recipes[0]) 118 self.assertFalse(excluded_present, 'Recipe %s was not excluded.' % native_recipes[0])
116 119
117 excluded_present = len(glob.glob(src_path_target + '/%s-*' % target_recipes[1])) 120 excluded_present = len(glob.glob(src_path_target + '/%s-*/*' % target_recipes[1]))
118 self.assertFalse(excluded_present, 'Recipe %s was not excluded.' % target_recipes[1]) 121 self.assertFalse(excluded_present, 'Recipe %s was not excluded.' % target_recipes[1])
119 122
123 def test_archiver_multiconfig_shared_unpack_and_patch(self):
124 """
125 Test that shared recipes in original mode with diff enabled works in multiconfig,
126 otherwise it will not build when using the same TMP dir.
127 """
128
129 features = 'BBMULTICONFIG = "mc1 mc2"\n'
130 features += 'INHERIT += "archiver"\n'
131 features += 'ARCHIVER_MODE[src] = "original"\n'
132 features += 'ARCHIVER_MODE[diff] = "1"\n'
133 self.write_config(features)
134
135 # We can use any machine in multiconfig as long as they are different
136 self.write_config('MACHINE = "qemuarm"\n', 'mc1')
137 self.write_config('MACHINE = "qemux86"\n', 'mc2')
138
139 task = 'do_unpack_and_patch'
140 # Use gcc-source as it is a shared recipe (appends the pv to the pn)
141 pn = 'gcc-source-%s' % get_bb_vars(['PV'], 'gcc')['PV']
142
143 # Generate the tasks signatures
144 bitbake('mc:mc1:%s mc:mc2:%s -c %s -S lockedsigs' % (pn, pn, task))
120 145
146 # Check the tasks signatures
147 # To be machine agnostic the tasks needs to generate the same signature for each machine
148 locked_sigs_inc = "%s/locked-sigs.inc" % self.builddir
149 locked_sigs = open(locked_sigs_inc).read()
150 task_sigs = re.findall(r"%s:%s:.*" % (pn, task), locked_sigs)
151 uniq_sigs = set(task_sigs)
152 self.assertFalse(len(uniq_sigs) - 1, \
153 'The task "%s" of the recipe "%s" has different signatures in "%s" for each machine in multiconfig' \
154 % (task, pn, locked_sigs_inc))
121 155
122 def test_archiver_srpm_mode(self): 156 def test_archiver_srpm_mode(self):
123 """ 157 """
@@ -156,28 +190,28 @@ class Archiver(OESelftestTestCase):
156 Test that the archiver works with `ARCHIVER_MODE[src] = "original"`. 190 Test that the archiver works with `ARCHIVER_MODE[src] = "original"`.
157 """ 191 """
158 192
159 self._test_archiver_mode('original', 'ed-1.14.1.tar.lz') 193 self._test_archiver_mode('original', 'ed-1.21.1.tar.lz')
160 194
161 def test_archiver_mode_patched(self): 195 def test_archiver_mode_patched(self):
162 """ 196 """
163 Test that the archiver works with `ARCHIVER_MODE[src] = "patched"`. 197 Test that the archiver works with `ARCHIVER_MODE[src] = "patched"`.
164 """ 198 """
165 199
166 self._test_archiver_mode('patched', 'selftest-ed-native-1.14.1-r0-patched.tar.gz') 200 self._test_archiver_mode('patched', 'selftest-ed-native-1.21.1-r0-patched.tar.xz')
167 201
168 def test_archiver_mode_configured(self): 202 def test_archiver_mode_configured(self):
169 """ 203 """
170 Test that the archiver works with `ARCHIVER_MODE[src] = "configured"`. 204 Test that the archiver works with `ARCHIVER_MODE[src] = "configured"`.
171 """ 205 """
172 206
173 self._test_archiver_mode('configured', 'selftest-ed-native-1.14.1-r0-configured.tar.gz') 207 self._test_archiver_mode('configured', 'selftest-ed-native-1.21.1-r0-configured.tar.xz')
174 208
175 def test_archiver_mode_recipe(self): 209 def test_archiver_mode_recipe(self):
176 """ 210 """
177 Test that the archiver works with `ARCHIVER_MODE[recipe] = "1"`. 211 Test that the archiver works with `ARCHIVER_MODE[recipe] = "1"`.
178 """ 212 """
179 213
180 self._test_archiver_mode('patched', 'selftest-ed-native-1.14.1-r0-recipe.tar.gz', 214 self._test_archiver_mode('patched', 'selftest-ed-native-1.21.1-r0-recipe.tar.xz',
181 'ARCHIVER_MODE[recipe] = "1"\n') 215 'ARCHIVER_MODE[recipe] = "1"\n')
182 216
183 def test_archiver_mode_diff(self): 217 def test_archiver_mode_diff(self):
@@ -186,7 +220,7 @@ class Archiver(OESelftestTestCase):
186 Exclusions controlled by `ARCHIVER_MODE[diff-exclude]` are not yet tested. 220 Exclusions controlled by `ARCHIVER_MODE[diff-exclude]` are not yet tested.
187 """ 221 """
188 222
189 self._test_archiver_mode('patched', 'selftest-ed-native-1.14.1-r0-diff.gz', 223 self._test_archiver_mode('patched', 'selftest-ed-native-1.21.1-r0-diff.gz',
190 'ARCHIVER_MODE[diff] = "1"\n') 224 'ARCHIVER_MODE[diff] = "1"\n')
191 225
192 def test_archiver_mode_dumpdata(self): 226 def test_archiver_mode_dumpdata(self):
@@ -194,7 +228,7 @@ class Archiver(OESelftestTestCase):
194 Test that the archiver works with `ARCHIVER_MODE[dumpdata] = "1"`. 228 Test that the archiver works with `ARCHIVER_MODE[dumpdata] = "1"`.
195 """ 229 """
196 230
197 self._test_archiver_mode('patched', 'selftest-ed-native-1.14.1-r0-showdata.dump', 231 self._test_archiver_mode('patched', 'selftest-ed-native-1.21.1-r0-showdata.dump',
198 'ARCHIVER_MODE[dumpdata] = "1"\n') 232 'ARCHIVER_MODE[dumpdata] = "1"\n')
199 233
200 def test_archiver_mode_mirror(self): 234 def test_archiver_mode_mirror(self):
@@ -202,7 +236,7 @@ class Archiver(OESelftestTestCase):
202 Test that the archiver works with `ARCHIVER_MODE[src] = "mirror"`. 236 Test that the archiver works with `ARCHIVER_MODE[src] = "mirror"`.
203 """ 237 """
204 238
205 self._test_archiver_mode('mirror', 'ed-1.14.1.tar.lz', 239 self._test_archiver_mode('mirror', 'ed-1.21.1.tar.lz',
206 'BB_GENERATE_MIRROR_TARBALLS = "1"\n') 240 'BB_GENERATE_MIRROR_TARBALLS = "1"\n')
207 241
208 def test_archiver_mode_mirror_excludes(self): 242 def test_archiver_mode_mirror_excludes(self):
@@ -213,7 +247,7 @@ class Archiver(OESelftestTestCase):
213 """ 247 """
214 248
215 target='selftest-ed' 249 target='selftest-ed'
216 target_file_name = 'ed-1.14.1.tar.lz' 250 target_file_name = 'ed-1.21.1.tar.lz'
217 251
218 features = 'INHERIT += "archiver"\n' 252 features = 'INHERIT += "archiver"\n'
219 features += 'ARCHIVER_MODE[src] = "mirror"\n' 253 features += 'ARCHIVER_MODE[src] = "mirror"\n'
@@ -251,7 +285,7 @@ class Archiver(OESelftestTestCase):
251 bitbake('-c deploy_archives %s' % (target)) 285 bitbake('-c deploy_archives %s' % (target))
252 286
253 bb_vars = get_bb_vars(['DEPLOY_DIR_SRC']) 287 bb_vars = get_bb_vars(['DEPLOY_DIR_SRC'])
254 for target_file_name in ['ed-1.14.1.tar.lz', 'hello.c']: 288 for target_file_name in ['ed-1.21.1.tar.lz', 'hello.c']:
255 glob_str = os.path.join(bb_vars['DEPLOY_DIR_SRC'], 'mirror', target_file_name) 289 glob_str = os.path.join(bb_vars['DEPLOY_DIR_SRC'], 'mirror', target_file_name)
256 glob_result = glob.glob(glob_str) 290 glob_result = glob.glob(glob_str)
257 self.assertTrue(glob_result, 'Missing archive file %s' % (target_file_name)) 291 self.assertTrue(glob_result, 'Missing archive file %s' % (target_file_name))