]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
selftest/bblayers: Add a test to validate bitbake-setup registry schema
authorYoann Congal <yoann.congal@smile.fr>
Fri, 24 Oct 2025 00:16:20 +0000 (02:16 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 27 Oct 2025 16:58:15 +0000 (16:58 +0000)
This test validates bitbake/default-registry/configurations/*.conf.json
against bitbake-setup.schema.json:
INFO - test_validate_bitbake_setup_default_registry (bblayers.BitbakeLayers.test_validate_bitbake_setup_default_registry)
DEBUG - Validating .../poky/bitbake/bin/../default-registry/configurations/oe-nodistro.conf.json
DEBUG - Validating .../poky/bitbake/bin/../default-registry/configurations/poky-master.conf.json
INFO -  ... ok
INFO - test_validate_examplelayersjson (bblayers.BitbakeLayers.test_validate_examplelayersjson)
INFO -  ... ok
INFO - ----------------------------------------------------------------------
INFO - Ran 2 tests in 110.469s
INFO - OK
INFO - RESULTS:
INFO - RESULTS - bblayers.BitbakeLayers.test_validate_bitbake_setup_default_registry: PASSED (0.92s)
INFO - RESULTS - bblayers.BitbakeLayers.test_validate_examplelayersjson: PASSED (0.19s)
INFO - SUMMARY:
INFO - oe-selftest () - Ran 2 tests in 110.469s
INFO - oe-selftest - OK - All required tests passed (successes=2, skipped=0, failures=0, errors=0)

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
meta/lib/oeqa/selftest/cases/bblayers.py

index 5b13c9dffe509389644e0fd3a9714e0e7b960b12..6c710b27516d12490ee097cffb3491c5272bc1f0 100644 (file)
@@ -21,8 +21,9 @@ class BitbakeLayers(OESelftestTestCase):
         bitbake("-c addto_recipe_sysroot python3-jsonschema-native")
 
         # Fetch variables used in multiple test cases
-        bb_vars = get_bb_vars(['COREBASE'])
+        bb_vars = get_bb_vars(['COREBASE', 'BITBAKEPATH'])
         cls.corebase = bb_vars['COREBASE']
+        cls.bitbakepath = bb_vars['BITBAKEPATH']
         cls.jsonschema_staging_bindir = get_bb_var('STAGING_BINDIR', 'python3-jsonschema-native')
 
     def test_bitbakelayers_layerindexshowdepends(self):
@@ -161,6 +162,19 @@ class BitbakeLayers(OESelftestTestCase):
         json = os.path.join(self.corebase, "meta/files/layers.example.json")
         self.validate_layersjson(json)
 
+    def test_validate_bitbake_setup_default_registry(self):
+        jsonschema = "bitbake-setup.schema.json"
+
+        default_registry_path = os.path.join(self.bitbakepath, "..", "default-registry", "configurations")
+
+        for root, _, files in os.walk(default_registry_path):
+            for f in files:
+                if not f.endswith(".conf.json"):
+                    continue
+                json = os.path.join(root, f)
+                self.logger.debug("Validating %s", json)
+                self.validate_json(json, jsonschema)
+
     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")