diff options
author | Jermain Horsman <jermain.horsman@nedap.com> | 2024-02-08 14:50:30 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-02-19 11:47:53 +0000 |
commit | 0fba76e5ad5162ed890ffc89bbf482804cfc7eba (patch) | |
tree | 4fcfbddcfb7f1c69bd1677741cbbb1dbc2c157c2 /meta/lib/oeqa/selftest | |
parent | dd2ed0c3630adfcf9f1be22d8608fbc871a7e0eb (diff) | |
download | poky-0fba76e5ad5162ed890ffc89bbf482804cfc7eba.tar.gz |
bitbake-layers: Add test case layers setup for custom references
This includes a simple test which creates a layer setup using
custom references, and subsequently modifies the resulting layers
setup using a different custom reference.
(From OE-Core rev: 36701e78cf239261ad21cf58db2934c3c8a5e3e6)
Signed-off-by: Jermain Horsman <jermain.horsman@nedap.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/bblayers.py | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/bblayers.py b/meta/lib/oeqa/selftest/cases/bblayers.py index e2009496ad..695d17377d 100644 --- a/meta/lib/oeqa/selftest/cases/bblayers.py +++ b/meta/lib/oeqa/selftest/cases/bblayers.py | |||
@@ -187,3 +187,56 @@ class BitbakeLayers(OESelftestTestCase): | |||
187 | 187 | ||
188 | cmd = '{} --layerlist {} setup -c {} --no-shell'.format(oe_setup_build_l, layers_json, conf) | 188 | cmd = '{} --layerlist {} setup -c {} --no-shell'.format(oe_setup_build_l, layers_json, conf) |
189 | result = runCmd(cmd) | 189 | result = runCmd(cmd) |
190 | |||
191 | def test_bitbakelayers_updatelayer(self): | ||
192 | result = runCmd('bitbake-layers create-layers-setup {}'.format(self.testlayer_path)) | ||
193 | jsonfile = os.path.join(self.testlayer_path, "setup-layers.json") | ||
194 | self.validate_layersjson(jsonfile) | ||
195 | |||
196 | import json | ||
197 | with open(jsonfile) as f: | ||
198 | data = json.load(f) | ||
199 | repos = [] | ||
200 | for s in data['sources']: | ||
201 | repos.append(s) | ||
202 | |||
203 | self.assertTrue(len(repos) > 1, "Not enough repositories available") | ||
204 | self.validate_layersjson(jsonfile) | ||
205 | |||
206 | test_ref_1 = 'ref_1' | ||
207 | test_ref_2 = 'ref_2' | ||
208 | |||
209 | # Create a new layers setup using custom references | ||
210 | result = runCmd('bitbake-layers create-layers-setup --use-custom-reference {first_repo}:{test_ref} --use-custom-reference {second_repo}:{test_ref} {path}' | ||
211 | .format(first_repo=repos[0], second_repo=repos[1], test_ref=test_ref_1, path=self.testlayer_path)) | ||
212 | self.validate_layersjson(jsonfile) | ||
213 | |||
214 | with open(jsonfile) as f: | ||
215 | data = json.load(f) | ||
216 | first_rev_1 = data['sources'][repos[0]]['git-remote']['rev'] | ||
217 | first_desc_1 = data['sources'][repos[0]]['git-remote']['describe'] | ||
218 | second_rev_1 = data['sources'][repos[1]]['git-remote']['rev'] | ||
219 | second_desc_1 = data['sources'][repos[1]]['git-remote']['describe'] | ||
220 | |||
221 | self.assertEqual(first_rev_1, test_ref_1, "Revision not set correctly: '{}'".format(first_rev_1)) | ||
222 | self.assertEqual(first_desc_1, '', "Describe not cleared: '{}'".format(first_desc_1)) | ||
223 | self.assertEqual(second_rev_1, test_ref_1, "Revision not set correctly: '{}'".format(second_rev_1)) | ||
224 | self.assertEqual(second_desc_1, '', "Describe not cleared: '{}'".format(second_desc_1)) | ||
225 | |||
226 | # Update one of the repositories in the layers setup using a different custom reference | ||
227 | # This should only update the selected repository, everything else should remain as is | ||
228 | result = runCmd('bitbake-layers create-layers-setup --update --use-custom-reference {first_repo}:{test_ref} {path}' | ||
229 | .format(first_repo=repos[0], test_ref=test_ref_2, path=self.testlayer_path)) | ||
230 | self.validate_layersjson(jsonfile) | ||
231 | |||
232 | with open(jsonfile) as f: | ||
233 | data = json.load(f) | ||
234 | first_rev_2 = data['sources'][repos[0]]['git-remote']['rev'] | ||
235 | first_desc_2 = data['sources'][repos[0]]['git-remote']['describe'] | ||
236 | second_rev_2 = data['sources'][repos[1]]['git-remote']['rev'] | ||
237 | second_desc_2 = data['sources'][repos[1]]['git-remote']['describe'] | ||
238 | |||
239 | self.assertEqual(first_rev_2, test_ref_2, "Revision not set correctly: '{}'".format(first_rev_2)) | ||
240 | self.assertEqual(first_desc_2, '', "Describe not cleared: '{}'".format(first_desc_2)) | ||
241 | self.assertEqual(second_rev_2, second_rev_1, "Revision should not be updated: '{}'".format(second_rev_2)) | ||
242 | self.assertEqual(second_desc_2, second_desc_1, "Describe should not be updated: '{}'".format(second_desc_2)) | ||