diff mbox series

[v3,3/3] lib/bb/tests/setup.py: add tests for oe-fragments-one-of

Message ID 20260122-bitbake-setup-choose-builtin-v3-3-c55291acc1a7@bootlin.com
State New
Headers show
Series bitbake-setup: add descriptions for fragment choices | expand

Commit Message

Antonin Godard Jan. 22, 2026, 3:02 p.m. UTC
There were no tests of oe-fragments-one-of so add a new configuration
for it, and test both formats for the options (with or without a
description).

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
 lib/bb/tests/setup.py | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

Comments

Alexander Kanavin Jan. 22, 2026, 5:54 p.m. UTC | #1
On Thu, 22 Jan 2026 at 16:02, Antonin Godard <antonin.godard@bootlin.com> wrote:
> +            },
> +            {
> +                "name": "gizmo-fragments-one-of",
> +                "description": "Gizmo configuration using oe-fragments-one-of, both formats",
> +                "oe-template": "test-configuration-gizmo",
> +                "oe-fragments-one-of": {
> +                    "fragment-desc": {
> +                        "description": "Test fragments (with description)",
> +                        "options" : [
> +                            { "name": "fragment-desc-1", "description": "fragment 1 desc" }
> +                        ]
> +                    },
> +                    "fragment-nodesc": {
> +                        "description": "Test fragments (no description)",
> +                        "options" : [
> +                            "fragment-nodesc-1"
> +                        ]
> +                    }
> +                }

To avoid multiplying test configs further (and making the tests
slower), perhaps this can be added to gizmo-notemplate, and that
renamed to gizmo-notemplate-fragments-one-of ?

> -                                                                 'gadget-notemplate','gizmo-notemplate')},
> +                                                                 'gadget-notemplate',
> +                                                                 'gizmo-notemplate',
> +                                                                 'gizmo-fragments-one-of fragment-desc-1 fragment-nodesc-1')},

As there's only one choice in each, bitbake-setup should pick that
without asking, or having to specify them on command line. Let's test
that too, and drop the fragment names from here.

Alex
diff mbox series

Patch

diff --git a/lib/bb/tests/setup.py b/lib/bb/tests/setup.py
index 834d098547c..eaada3ce1e7 100644
--- a/lib/bb/tests/setup.py
+++ b/lib/bb/tests/setup.py
@@ -146,6 +146,25 @@  print("BBPATH is {{}}".format(os.environ["BBPATH"]))
                 "bb-layers": ["layerC","layerD/meta-layer"],
                 "bb-layers-file-relative": ["layerE/meta-layer"],
                 "oe-fragments": ["test-fragment-2"]
+            },
+            {
+                "name": "gizmo-fragments-one-of",
+                "description": "Gizmo configuration using oe-fragments-one-of, both formats",
+                "oe-template": "test-configuration-gizmo",
+                "oe-fragments-one-of": {
+                    "fragment-desc": {
+                        "description": "Test fragments (with description)",
+                        "options" : [
+                            { "name": "fragment-desc-1", "description": "fragment 1 desc" }
+                        ]
+                    },
+                    "fragment-nodesc": {
+                        "description": "Test fragments (no description)",
+                        "options" : [
+                            "fragment-nodesc-1"
+                        ]
+                    }
+                }
             }
         ]
     },
@@ -258,7 +277,7 @@  print("BBPATH is {{}}".format(os.environ["BBPATH"]))
     def get_setup_path(self, cf, c):
         if c == 'gizmo':
             return os.path.join(self.tempdir, 'bitbake-builds', 'this-is-a-custom-gizmo-build')
-        return os.path.join(self.tempdir, 'bitbake-builds', '{}-{}'.format(cf, c))
+        return os.path.join(self.tempdir, 'bitbake-builds', '{}-{}'.format(cf, "-".join(c.split())))
 
     def test_setup(self):
         # unset BBPATH to ensure tests run in isolation from the existing bitbake environment
@@ -328,7 +347,9 @@  print("BBPATH is {{}}".format(os.environ["BBPATH"]))
                                                  'buildconfigs':('gadget','gizmo',
                                                                  'gizmo-env-passthrough',
                                                                  'gizmo-no-fragment',
-                                                                 'gadget-notemplate','gizmo-notemplate')},
+                                                                 'gadget-notemplate',
+                                                                 'gizmo-notemplate',
+                                                                 'gizmo-fragments-one-of fragment-desc-1 fragment-nodesc-1')},
                                'test-config-2': {'cmdline': os.path.join(self.registrypath,'config-2/test-config-2.conf.json'),
                                                  'buildconfigs': ('gadget','gizmo',
                                                                   'gizmo-env-passthrough',