Message ID | 20240104123420.932-4-jermain.horsman@nedap.com |
---|---|
State | New |
Headers | show |
Series | bitbake-layers: Add possibility to update layers setup | expand |
The test case is fine, lgtm. Alex On Thu, 4 Jan 2024 at 13:35, Jermain Horsman <jermain.horsman@nedap.com> wrote: > > From: Jermain Horsman <jermain.horsman@nedap.com> > > This includes a simple test which creates a layer setup, > modifies it using a test string and checks if the resulting > layer setup is written correctly. > > Signed-off-by: Jermain Horsman <jermain.horsman@nedap.com> > --- > meta/lib/oeqa/selftest/cases/bblayers.py | 26 ++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/meta/lib/oeqa/selftest/cases/bblayers.py b/meta/lib/oeqa/selftest/cases/bblayers.py > index 8faa060234..0467fbb736 100644 > --- a/meta/lib/oeqa/selftest/cases/bblayers.py > +++ b/meta/lib/oeqa/selftest/cases/bblayers.py > @@ -167,3 +167,29 @@ class BitbakeLayers(OESelftestTestCase): > oecoredir = os.listdir(testcheckoutdir)[0] > testcheckoutfile = os.path.join(testcheckoutdir, oecoredir, "oe-init-build-env") > self.assertTrue(os.path.exists(testcheckoutfile), "File {} not found in test layer checkout".format(testcheckoutfile)) > + > + def test_bitbakelayers_updatelayer(self): > + result = runCmd('bitbake-layers create-layers-setup {}'.format(self.testlayer_path)) > + jsonfile = os.path.join(self.testlayer_path, "setup-layers.json") > + self.validate_layersjson(jsonfile) > + > + import json > + with open(jsonfile) as f: > + data = json.load(f) > + test_repo = None > + for s in data['sources']: > + if 'contains_this_file' not in data['sources'][s].keys(): > + test_repo = s > + result = runCmd('bitbake-layers create-layers-setup --update {} --reference {} {}'.format(test_repo, 'remote/test', self.testlayer_path)) > + break > + > + self.assertTrue(test_repo, "No test repo found") > + self.validate_layersjson(jsonfile) > + > + with open(jsonfile) as f: > + data = json.load(f) > + curr_rev = data['sources'][test_repo]['git-remote']['rev'] > + curr_desc = data['sources'][test_repo]['git-remote']['describe'] > + > + self.assertEqual(curr_rev, 'remote/test', "Revision not set correctly: '{}'".format(curr_rev)) > + self.assertEqual(curr_desc, '', "Describe not cleared: '{}'".format(curr_desc)) > -- > 2.42.0.windows.2 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#193318): https://lists.openembedded.org/g/openembedded-core/message/193318 > Mute This Topic: https://lists.openembedded.org/mt/103521081/1686489 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- >
diff --git a/meta/lib/oeqa/selftest/cases/bblayers.py b/meta/lib/oeqa/selftest/cases/bblayers.py index 8faa060234..0467fbb736 100644 --- a/meta/lib/oeqa/selftest/cases/bblayers.py +++ b/meta/lib/oeqa/selftest/cases/bblayers.py @@ -167,3 +167,29 @@ class BitbakeLayers(OESelftestTestCase): oecoredir = os.listdir(testcheckoutdir)[0] testcheckoutfile = os.path.join(testcheckoutdir, oecoredir, "oe-init-build-env") self.assertTrue(os.path.exists(testcheckoutfile), "File {} not found in test layer checkout".format(testcheckoutfile)) + + def test_bitbakelayers_updatelayer(self): + result = runCmd('bitbake-layers create-layers-setup {}'.format(self.testlayer_path)) + jsonfile = os.path.join(self.testlayer_path, "setup-layers.json") + self.validate_layersjson(jsonfile) + + import json + with open(jsonfile) as f: + data = json.load(f) + test_repo = None + for s in data['sources']: + if 'contains_this_file' not in data['sources'][s].keys(): + test_repo = s + result = runCmd('bitbake-layers create-layers-setup --update {} --reference {} {}'.format(test_repo, 'remote/test', self.testlayer_path)) + break + + self.assertTrue(test_repo, "No test repo found") + self.validate_layersjson(jsonfile) + + with open(jsonfile) as f: + data = json.load(f) + curr_rev = data['sources'][test_repo]['git-remote']['rev'] + curr_desc = data['sources'][test_repo]['git-remote']['describe'] + + self.assertEqual(curr_rev, 'remote/test', "Revision not set correctly: '{}'".format(curr_rev)) + self.assertEqual(curr_desc, '', "Describe not cleared: '{}'".format(curr_desc))