diff mbox series

[6/6] selftest/bblayers: add a test for creating a layer setup and using it to restore the layers

Message ID 20220729141049.835733-6-alex@linutronix.de
State New
Headers show
Series [1/6] scripts/oe-setup-builddir: make it known where configurations come from | expand

Commit Message

Alexander Kanavin July 29, 2022, 2:10 p.m. UTC
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 | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Richard Purdie Aug. 16, 2022, 8:29 p.m. UTC | #1
On Fri, 2022-07-29 at 16:10 +0200, Alexander Kanavin wrote:
> 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 | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/meta/lib/oeqa/selftest/cases/bblayers.py b/meta/lib/oeqa/selftest/cases/bblayers.py
> index 4f4952f3eb..1f5c576356 100644
> --- a/meta/lib/oeqa/selftest/cases/bblayers.py
> +++ b/meta/lib/oeqa/selftest/cases/bblayers.py
> @@ -140,3 +140,15 @@ 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)
> +
> +        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'
> +        pokydir = os.listdir(testcheckoutdir)[0]
> +        testcheckoutfile = os.path.join(testcheckoutdir, pokydir, "oe-init-build-env")
> +        self.assertTrue(os.path.exists(testcheckoutfile), "File {} not found in test layer checkout".format(testcheckoutfile))

https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/4001/steps/14/logs/stdio

(and other similar selftest failures)

I suspect this was due to master-next being force pushed whilst the
build was running.

Cheers,

Richard
Alexander Kanavin Aug. 16, 2022, 8:41 p.m. UTC | #2
On Tue, 16 Aug 2022 at 22:29, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:

> https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/4001/steps/14/logs/stdio
>
> (and other similar selftest failures)
>
> I suspect this was due to master-next being force pushed whilst the
> build was running.

Right, the test operates on the poky-under-test revision, and should
either patch the generated json to contain a revision from a stable
branch, or do a pristine poky checkout into a temp dir first.

Alex
diff mbox series

Patch

diff --git a/meta/lib/oeqa/selftest/cases/bblayers.py b/meta/lib/oeqa/selftest/cases/bblayers.py
index 4f4952f3eb..1f5c576356 100644
--- a/meta/lib/oeqa/selftest/cases/bblayers.py
+++ b/meta/lib/oeqa/selftest/cases/bblayers.py
@@ -140,3 +140,15 @@  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)
+
+        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'
+        pokydir = os.listdir(testcheckoutdir)[0]
+        testcheckoutfile = os.path.join(testcheckoutdir, pokydir, "oe-init-build-env")
+        self.assertTrue(os.path.exists(testcheckoutfile), "File {} not found in test layer checkout".format(testcheckoutfile))