diff mbox series

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

Message ID 20260123-bitbake-setup-choose-builtin-v4-3-99361f2128f6@bootlin.com
State New
Headers show
Series bitbake-setup: add descriptions for fragment choices | expand

Commit Message

Antonin Godard Jan. 23, 2026, 1:24 p.m. UTC
There were no tests of oe-fragments-one-of so modify gizmo-notemplate to
gizmo-notemplate-fragments-one-of, and test both formats for the options
(with or without a description).

In get_setup_path(), if the configuration specified on the command-line
contains fragments, join everything with "-" as this is what will be the
final directory name of the setup. This does not affect other current
variants.

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
 lib/bb/tests/setup.py | 31 +++++++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/lib/bb/tests/setup.py b/lib/bb/tests/setup.py
index 8b6046c049a..744dfe903ed 100644
--- a/lib/bb/tests/setup.py
+++ b/lib/bb/tests/setup.py
@@ -136,10 +136,26 @@  print("BBPATH is {{}}".format(os.environ["BBPATH"]))
                 "oe-fragments": ["test-fragment-1"]
             },
             {
-                "name": "gizmo-notemplate",
+                "name": "gizmo-notemplate-fragments-one-of",
                 "description": "Gizmo notemplate configuration",
                 "bb-layers": ["layerC","layerD/meta-layer"],
-                "oe-fragments": ["test-fragment-2"]
+                "oe-fragments": ["test-fragment-2"],
+                "oe-fragments-one-of": {
+                    "fragment-desc": {
+                        "description": "Test fragments (with description)",
+                        "options" : [
+                            { "name": "fragment-desc-1", "description": "fragment 1 desc" },
+                            { "name": "fragment-desc-2", "description": "fragment 2 desc" }
+                        ]
+                    },
+                    "fragment-nodesc": {
+                        "description": "Test fragments (no description)",
+                        "options" : [
+                            "fragment-nodesc-1",
+                            "fragment-nodesc-2"
+                        ]
+                    }
+                }
             },
             {
                 "name": "gizmo-notemplate-with-filerelative-layers",
@@ -259,7 +275,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
@@ -327,7 +343,14 @@  print("BBPATH is {{}}".format(os.environ["BBPATH"]))
         # test-config-1 is tested as a registry config and over http, test-config-2 as a local file
         server = HTTPService(self.registrypath, host="127.0.0.1")
         server.start()
-        variants = ('gadget','gizmo','gizmo-env-passthrough','gizmo-no-fragment','gadget-notemplate','gizmo-notemplate')
+        variants = (
+            'gadget',
+            'gizmo',
+            'gizmo-env-passthrough',
+            'gizmo-no-fragment',
+            'gadget-notemplate',
+            'gizmo-notemplate-fragments-one-of fragment-desc-1 fragment-nodesc-1',
+        )
         variants_local = variants + ('gizmo-notemplate-with-filerelative-layers',)
         test_configurations = ({'name':'test-config-1','cmdline': 'test-config-1',
                                                  'buildconfigs': variants},