mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-05-09 08:56:55 +00:00
Sometimes service vm cat settings will not generate successfully, now fix it. Tracked-On: #6691 Signed-off-by: Weiyi Feng <weiyix.feng@intel.com>
63 lines
1.8 KiB
Python
63 lines
1.8 KiB
Python
#!/usr/bin/env python3
|
|
__package__ = 'configurator.pyodide'
|
|
|
|
from pathlib import Path
|
|
from tempfile import TemporaryDirectory
|
|
|
|
from scenario_config.default_populator import DefaultValuePopulatingStage
|
|
from scenario_config.pipeline import PipelineObject, PipelineEngine
|
|
from scenario_config.validator import ValidatorConstructionByFileStage, SemanticValidationStage, \
|
|
SyntacticValidationStage
|
|
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):
|
|
pipeline = PipelineEngine(["board_path", "scenario_path", "schema_path", "datachecks_path"])
|
|
stages = [
|
|
ValidatorConstructionByFileStage(),
|
|
XMLLoadStage("schema"),
|
|
|
|
XMLLoadStage("board"),
|
|
XMLLoadStage("scenario"),
|
|
DefaultValuePopulatingStage(),
|
|
SemanticValidationStage(),
|
|
]
|
|
#
|
|
# if is_debug:
|
|
# stages.append(SyntacticValidationStage())
|
|
|
|
pipeline.add_stages(stages)
|
|
with TemporaryDirectory() as tmpdir:
|
|
write_temp_file(tmpdir, {
|
|
'board.xml': board,
|
|
'scenario.xml': scenario
|
|
})
|
|
board_file_path = Path(tmpdir) / 'board.xml'
|
|
scenario_file_path = Path(tmpdir) / 'scenario.xml'
|
|
|
|
obj = PipelineObject(
|
|
board_path=board_file_path,
|
|
scenario_path=scenario_file_path,
|
|
schema_path=scenario_xml_schema_path,
|
|
datachecks_path=datachecks_xml_schema_path
|
|
)
|
|
pipeline.run(obj)
|
|
|
|
validate_result = obj.get("semantic_errors")
|
|
return convert_result(validate_result)
|
|
|
|
|
|
def test():
|
|
main(nuc11_board, nuc11_scenario)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
test()
|