diff options
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/archiver.py')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/archiver.py | 56 |
1 files changed, 45 insertions, 11 deletions
diff --git a/meta/lib/oeqa/selftest/cases/archiver.py b/meta/lib/oeqa/selftest/cases/archiver.py index ddd08ecf84..3cb888c506 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 | ||
5 | import os | 7 | import os |
6 | import glob | 8 | import glob |
9 | import re | ||
7 | from oeqa.utils.commands import bitbake, get_bb_vars | 10 | from oeqa.utils.commands import bitbake, get_bb_vars |
8 | from oeqa.selftest.case import OESelftestTestCase | 11 | from 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 | """ |
@@ -163,21 +197,21 @@ class Archiver(OESelftestTestCase): | |||
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.14.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.14.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.14.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): |