selftest/bblayers: Add a test to validate bitbake-setup registry schema

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)

(From OE-Core rev: 86978295c228640e2c33076d1f51db9f2fe7063b)

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Yoann Congal 2025-10-24 02:16:20 +02:00 committed by Richard Purdie
parent 41438346ce
commit 440fba30b7

View 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")