@@ -136,15 +136,24 @@ class BitbakeLayers(OESelftestTestCase):
self.assertTrue(os.path.isfile(recipe_file), msg = "Can't find recipe file for %s" % recipe)
return os.path.basename(recipe_file)
- def validate_layersjson(self, json):
- python = os.path.join(get_bb_var('STAGING_BINDIR', 'python3-jsonschema-native'), 'nativepython3')
- jsonvalidator = os.path.join(get_bb_var('STAGING_BINDIR', 'python3-jsonschema-native'), 'jsonschema')
- jsonschema = os.path.join(get_bb_var('COREBASE'), 'meta/files/layers.schema.json')
- result = runCmd("{} {} -i {} {}".format(python, jsonvalidator, json, jsonschema))
+ def validate_json(self, json, jsonschema):
+ staging_bindir = get_bb_var('STAGING_BINDIR', 'python3-jsonschema-native')
+ python = os.path.join(staging_bindir, 'nativepython3')
+ jsonvalidator = os.path.join(staging_bindir, 'jsonschema')
+ schemas_dir = os.path.join(get_bb_var('COREBASE'), "meta/files/")
+ if not os.path.isabs(jsonschema):
+ jsonschema = os.path.join(schemas_dir, jsonschema)
+
+ result = runCmd(
+ "{} {} -i {} --base-uri file://{}/ {}".format(
+ python, jsonvalidator, json, schemas_dir, jsonschema
+ )
+ )
def test_validate_examplelayersjson(self):
json = os.path.join(get_bb_var('COREBASE'), "meta/files/layers.example.json")
- self.validate_layersjson(json)
+ jsonschema = "layers.schema.json"
+ self.validate_json(json, jsonschema)
def test_bitbakelayers_setup(self):
result = runCmd('bitbake-layers create-layers-setup {}'.format(self.testlayer_path))