diff options
author | Paul Barker <paul@betafive.co.uk> | 2019-11-11 14:16:21 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-11-27 13:25:18 +0000 |
commit | d5c1a7607ff24062f7d5258a8e3da1ca6a4ec451 (patch) | |
tree | 1eca4056aed6b21d4388e8b264d5da933154d3e6 /meta | |
parent | 89288705c682bceea52302cc607ff221ca30f3d1 (diff) | |
download | poky-d5c1a7607ff24062f7d5258a8e3da1ca6a4ec451.tar.gz |
oeqa: archiver: Add basic tests for all archiver modes
6 new test cases are added to cover the various archiver modes
documented at the top of archiver.bbclass. Each test sets the
appropriate configuration options, runs the `do_deploy_archives` task
for the selftest-ed recipe and checks for the presence of the expected
archive file.
(From OE-Core rev: d3bf1012e918109e958cf78c89feda0f4dfe17c5)
Signed-off-by: Paul Barker <paul@betafive.co.uk>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/archiver.py | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/archiver.py b/meta/lib/oeqa/selftest/cases/archiver.py index f8672f8abb..6bd0e06ec4 100644 --- a/meta/lib/oeqa/selftest/cases/archiver.py +++ b/meta/lib/oeqa/selftest/cases/archiver.py | |||
@@ -129,3 +129,69 @@ class Archiver(OESelftestTestCase): | |||
129 | self.write_config(features) | 129 | self.write_config(features) |
130 | 130 | ||
131 | bitbake('-n core-image-sato') | 131 | bitbake('-n core-image-sato') |
132 | |||
133 | def _test_archiver_mode(self, mode, target_file_name, extra_config=None): | ||
134 | target = "selftest-ed" | ||
135 | |||
136 | features = 'INHERIT += "archiver"\n' | ||
137 | features += 'ARCHIVER_MODE[src] = "%s"\n' % (mode) | ||
138 | if extra_config: | ||
139 | features += extra_config | ||
140 | self.write_config(features) | ||
141 | |||
142 | bitbake('-c clean %s' % (target)) | ||
143 | bitbake('-c deploy_archives %s' % (target)) | ||
144 | |||
145 | bb_vars = get_bb_vars(['DEPLOY_DIR_SRC', 'TARGET_SYS']) | ||
146 | glob_str = os.path.join(bb_vars['DEPLOY_DIR_SRC'], bb_vars['TARGET_SYS'], '%s-*' % (target)) | ||
147 | glob_result = glob.glob(glob_str) | ||
148 | self.assertTrue(glob_result, 'Missing archiver directory for %s' % (target)) | ||
149 | |||
150 | archive_path = os.path.join(glob_result[0], target_file_name) | ||
151 | self.assertTrue(os.path.exists(archive_path), 'Missing archive file %s' % (target_file_name)) | ||
152 | |||
153 | def test_archiver_mode_original(self): | ||
154 | """ | ||
155 | Test that the archiver works in with `ARCHIVER_MODE[src] = "original"`. | ||
156 | """ | ||
157 | |||
158 | self._test_archiver_mode('original', 'ed-1.14.1.tar.lz') | ||
159 | |||
160 | def test_archiver_mode_patched(self): | ||
161 | """ | ||
162 | Test that the archiver works in with `ARCHIVER_MODE[src] = "patched"`. | ||
163 | """ | ||
164 | |||
165 | self._test_archiver_mode('patched', 'selftest-ed-1.14.1-r0-patched.tar.gz') | ||
166 | |||
167 | def test_archiver_mode_configured(self): | ||
168 | """ | ||
169 | Test that the archiver works in with `ARCHIVER_MODE[src] = "configured"`. | ||
170 | """ | ||
171 | |||
172 | self._test_archiver_mode('configured', 'selftest-ed-1.14.1-r0-configured.tar.gz') | ||
173 | |||
174 | def test_archiver_mode_recipe(self): | ||
175 | """ | ||
176 | Test that the archiver works in with `ARCHIVER_MODE[recipe] = "1"`. | ||
177 | """ | ||
178 | |||
179 | self._test_archiver_mode('patched', 'selftest-ed-1.14.1-r0-recipe.tar.gz', | ||
180 | 'ARCHIVER_MODE[recipe] = "1"\n') | ||
181 | |||
182 | def test_archiver_mode_diff(self): | ||
183 | """ | ||
184 | Test that the archiver works in with `ARCHIVER_MODE[diff] = "1"`. | ||
185 | Exclusions controlled by `ARCHIVER_MODE[diff-exclude]` are not yet tested. | ||
186 | """ | ||
187 | |||
188 | self._test_archiver_mode('patched', 'selftest-ed-1.14.1-r0-diff.gz', | ||
189 | 'ARCHIVER_MODE[diff] = "1"\n') | ||
190 | |||
191 | def test_archiver_mode_dumpdata(self): | ||
192 | """ | ||
193 | Test that the archiver works in with `ARCHIVER_MODE[dumpdata] = "1"`. | ||
194 | """ | ||
195 | |||
196 | self._test_archiver_mode('patched', 'selftest-ed-1.14.1-r0-showdata.dump', | ||
197 | 'ARCHIVER_MODE[dumpdata] = "1"\n') | ||