All of lore.kernel.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 6/7] selftest/bblayers: add a test for creating a layer setup and using it to restore the layers
Date: Wed, 31 Aug 2022 13:14:00 +0200	[thread overview]
Message-ID: <20220831111401.3330342-6-alex@linutronix.de> (raw)
In-Reply-To: <20220831111401.3330342-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-31 11:14 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-31 11:13 [PATCH 1/7] scripts/oe-setup-builddir: add a check that TEMPLATECONF is valid Alexander Kanavin
2022-08-31 11:13 ` [PATCH 2/7] bitbake-layers: add a command to save the active build configuration as a template into a layer Alexander Kanavin
2022-08-31 11:13 ` [PATCH 3/7] meta/files: add layer setup JSON schema and example Alexander Kanavin
2022-08-31 11:13 ` [PATCH 4/7] bitbake-layers: add ability to save current layer repository configuration into a file Alexander Kanavin
2022-08-31 11:13 ` [PATCH 5/7] scripts/oe-setup-layers: add a script that restores the layer configuration from a json file Alexander Kanavin
2022-08-31 11:14 ` Alexander Kanavin [this message]
2022-08-31 11:14 ` [PATCH 7/7] selftest/bblayers: adjust the revision for the layer setup test Alexander Kanavin
2022-09-14  3:27 ` [OE-core] [PATCH 1/7] scripts/oe-setup-builddir: add a check that TEMPLATECONF is valid ChenQi
2022-09-14  5:00   ` Alexander Kanavin
2022-09-14  5:49     ` ChenQi
2022-09-14  6:39       ` Alexander Kanavin
2022-09-14  7:42         ` ChenQi
2022-09-14  8:03           ` Alexander Kanavin
2022-09-14  8:17             ` ChenQi
2022-09-14  8:42               ` Alexander Kanavin
2022-09-15  1:07                 ` Peter Kjellerstedt
2022-09-15  9:20                   ` Alexander Kanavin
2022-09-15 22:59                     ` Peter Kjellerstedt
2022-09-16 10:57                       ` Alexander Kanavin
2022-09-17  0:06                         ` Peter Kjellerstedt
2022-09-17  8:17                           ` 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=20220831111401.3330342-6-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.