diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2022-08-31 13:14:00 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-09-01 10:07:02 +0100 |
commit | fe7eb16537ae04cf6afaa368c7a4ce6991dcbd2f (patch) | |
tree | ad6397afef728b8f9993de3bcfd296027d59b34c | |
parent | aa09f4d928eb01613acd8db9a6ecd84be6d1a8e3 (diff) | |
download | poky-fe7eb16537ae04cf6afaa368c7a4ce6991dcbd2f.tar.gz |
selftest/bblayers: add a test for creating a layer setup and using it to restore the layers
This does a basic run-through of the bitbake-layers plugin, and the resulting json layer config
and the layer setup script that uses it. Only poky is actually fetched by the script.
(From OE-Core rev: 84ddd6fc6effbb74499409da7e85c09c8a1ff9ea)
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/lib/oeqa/selftest/cases/bblayers.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/bblayers.py b/meta/lib/oeqa/selftest/cases/bblayers.py index c753a7b795..18007764b3 100644 --- a/meta/lib/oeqa/selftest/cases/bblayers.py +++ b/meta/lib/oeqa/selftest/cases/bblayers.py | |||
@@ -142,3 +142,25 @@ class BitbakeLayers(OESelftestTestCase): | |||
142 | def test_validate_examplelayersjson(self): | 142 | def test_validate_examplelayersjson(self): |
143 | json = os.path.join(get_bb_var('COREBASE'), "meta/files/layers.example.json") | 143 | json = os.path.join(get_bb_var('COREBASE'), "meta/files/layers.example.json") |
144 | self.validate_layersjson(json) | 144 | self.validate_layersjson(json) |
145 | |||
146 | def test_bitbakelayers_setup(self): | ||
147 | result = runCmd('bitbake-layers create-layers-setup {}'.format(self.testlayer_path)) | ||
148 | jsonfile = os.path.join(self.testlayer_path, "setup-layers.json") | ||
149 | self.validate_layersjson(jsonfile) | ||
150 | |||
151 | # The revision-under-test may not necessarily be available on the remote server, | ||
152 | # so replace it with a stable release tag. | ||
153 | import json | ||
154 | with open(jsonfile) as f: | ||
155 | data = json.load(f) | ||
156 | for s in data['sources']: | ||
157 | data['sources'][s]['git-remote']['rev'] = 'yocto-4.0' | ||
158 | with open(jsonfile, 'w') as f: | ||
159 | json.dump(data, f) | ||
160 | |||
161 | testcheckoutdir = os.path.join(self.builddir, 'test-layer-checkout') | ||
162 | result = runCmd('{}/setup-layers --destdir {}'.format(self.testlayer_path, testcheckoutdir)) | ||
163 | # May not necessarily be named 'poky' or 'openembedded-core' | ||
164 | oecoredir = os.listdir(testcheckoutdir)[0] | ||
165 | testcheckoutfile = os.path.join(testcheckoutdir, oecoredir, "oe-init-build-env") | ||
166 | self.assertTrue(os.path.exists(testcheckoutfile), "File {} not found in test layer checkout".format(testcheckoutfile)) | ||