config_tools: add SyntacticValidationStage before save scenario

add SyntacticValidationStage before save scenario

Tracked-On: #6691
Signed-off-by: Weiyi Feng <weiyix.feng@intel.com>
This commit is contained in:
Weiyi Feng
2022-06-09 18:23:16 +08:00
committed by acrnsi-robot
parent 05fd75eeda
commit a60b774c61
3 changed files with 50 additions and 15 deletions

View File

@@ -12,13 +12,11 @@ from scenario_config.xml_loader import XMLLoadStage
from .pyodide import (
convert_result, write_temp_file,
# Todo: add debug switch
# is_debug,
nuc11_board, nuc11_scenario, scenario_xml_schema_path, datachecks_xml_schema_path
)
def main(board, scenario):
def main(board, scenario, completed_verify=False):
pipeline = PipelineEngine(["board_path", "scenario_path", "schema_path", "datachecks_path"])
stages = [
ValidatorConstructionByFileStage(),
@@ -27,11 +25,10 @@ def main(board, scenario):
XMLLoadStage("board"),
XMLLoadStage("scenario"),
DefaultValuePopulatingStage(),
SemanticValidationStage(),
SyntacticValidationStage()
]
#
# if is_debug:
# stages.append(SyntacticValidationStage())
if completed_verify:
stages.append(SemanticValidationStage())
pipeline.add_stages(stages)
with TemporaryDirectory() as tmpdir:
@@ -50,7 +47,9 @@ def main(board, scenario):
)
pipeline.run(obj)
validate_result = obj.get("semantic_errors")
validate_result: list = obj.get("syntactic_errors")
if completed_verify:
validate_result.extend(obj.get("semantic_errors"))
return convert_result(validate_result)