public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Alexander Kanavin <alex.kanavin@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Alexander Kanavin <alex@linutronix.de>
Subject: [PATCH 5/5] selftest/bblayers: add a test for creating a layer setup and using it to restore the layers
Date: Thu, 25 Aug 2022 22:34:51 +0200	[thread overview]
Message-ID: <20220825203451.2074080-5-alex@linutronix.de> (raw)
In-Reply-To: <20220825203451.2074080-1-alex@linutronix.de>

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.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 meta/lib/oeqa/selftest/cases/bblayers.py | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

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):
     def test_validate_examplelayersjson(self):
         json = os.path.join(get_bb_var('COREBASE'), "meta/files/layers.example.json")
         self.validate_layersjson(json)
+
+    def test_bitbakelayers_setup(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)
+
+        # The revision-under-test may not necessarily be available on the remote server,
+        # so replace it with a stable release tag.
+        import json
+        with open(jsonfile) as f:
+            data = json.load(f)
+        for s in data['sources']:
+            data['sources'][s]['git-remote']['rev'] = 'yocto-4.0'
+        with open(jsonfile, 'w') as f:
+            json.dump(data, f)
+
+        testcheckoutdir = os.path.join(self.builddir, 'test-layer-checkout')
+        result = runCmd('{}/setup-layers --destdir {}'.format(self.testlayer_path, testcheckoutdir))
+        # May not necessarily be named 'poky' or 'openembedded-core'
+        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))
-- 
2.30.2



  parent reply	other threads:[~2022-08-25 20:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-25 20:34 [PATCH 1/5] bitbake-layers: add a command to save the active build configuration as a template into a layer Alexander Kanavin
2022-08-25 20:34 ` [PATCH 2/5] meta/files: add layer setup JSON schema and example Alexander Kanavin
2022-08-25 20:34 ` [PATCH 3/5] bitbake-layers: add ability to save current layer repository configuration into a file Alexander Kanavin
2022-08-25 20:34 ` [PATCH 4/5] scripts/oe-setup-layers: add a script that restores the layer configuration from a json file Alexander Kanavin
2022-08-26 10:37   ` [OE-core] " Luca Ceresoli
2022-08-25 20:34 ` Alexander Kanavin [this message]
2022-08-26 15:25 ` [OE-core] [PATCH 1/5] bitbake-layers: add a command to save the active build configuration as a template into a layer Luca Ceresoli
2022-08-26 15:46   ` Alexander Kanavin
2022-08-27 16:41   ` Alexander Kanavin
     [not found] ` <170EEE7825BF9D73.11791@lists.openembedded.org>
2022-08-27 19:32   ` Luca Ceresoli
2022-08-27 21:32     ` Alexander Kanavin
     [not found]     ` <170F511AB039C9FD.22386@lists.openembedded.org>
2022-08-28 12:01       ` Alexander Kanavin
2022-08-29 14:38         ` Luca Ceresoli
2022-08-29 19:19           ` Alexander Kanavin
  -- strict thread matches above, loose matches on Subject: below --
2022-08-17 13:10 Alexander Kanavin
2022-08-17 13:10 ` [PATCH 5/5] selftest/bblayers: add a test for creating a layer setup and using it to restore the layers Alexander Kanavin
2022-08-02 13:57 [PATCH 1/5] bitbake-layers: add a command to save the active build configuration as a template into a layer Alexander Kanavin
2022-08-02 13:57 ` [PATCH 5/5] selftest/bblayers: add a test for creating a layer setup and using it to restore the layers Alexander Kanavin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220825203451.2074080-5-alex@linutronix.de \
    --to=alex.kanavin@gmail.com \
    --cc=alex@linutronix.de \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox