The test should be doing this sequence:

1. Write a new json file with two different custom references (if we
go with --use-custom-reference repo,reference).
2. Check that both custom references are written correctly.
3. Use --update to update one of the custom references but not the other.
4. Check that one custom reference was updated, but the other was not.

Alex


On Mon, 8 Jan 2024 at 15:42, Jermain Horsman <jermain.hors...@nedap.com> wrote:
>
> From: Jermain Horsman <jermain.hors...@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.hors...@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..f07fbd46fb 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 
> --repository {} --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 (#193450): 
https://lists.openembedded.org/g/openembedded-core/message/193450
Mute This Topic: https://lists.openembedded.org/mt/103598120/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to