import os
import struct
import yaml
+import yamllint
from collections import OrderedDict
from jsonschema import validate
from binman.etype.section import Entry_section
from dtoc import fdt_util
from u_boot_pylib import tools
+from yamllint import config
BOARDCFG = 0xB
BOARDCFG_SEC = 0xD
with open(self._schema_file, 'r') as sch:
self.schema_yaml = yaml.safe_load(sch)
+ yaml_config = config.YamlLintConfig("extends: default")
+ for p in yamllint.linter.run(open(self._config_file, "r"), yaml_config):
+ self.Raise(f"Yamllint error: {p.line}: {p.rule}")
try:
validate(self.file_yaml, self.schema_yaml)
except Exception as e:
data = self._DoReadFile('293_ti_board_cfg.dts')
self.assertEqual(TI_BOARD_CONFIG_DATA, data)
+ def testTIBoardConfigLint(self):
+ """Test that an incorrectly linted config file would generate error"""
+ with self.assertRaises(ValueError) as e:
+ data = self._DoReadFile('323_ti_board_cfg_phony.dts')
+ self.assertIn("Yamllint error", str(e.exception))
+
def testTIBoardConfigCombined(self):
"""Test that a schema validated combined board config file can be generated"""
data = self._DoReadFile('294_ti_board_cfg_combined.dts')
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ binman {
+ ti-board-config {
+ config = "yaml/config_phony.yaml";
+ schema = "yaml/schema.yaml";
+ };
+ };
+};