config_tools: fix a module resolving issue in elementpath overlay

The library module introduced by commit 2cd13026e ("misc: move the RDT
interface to common library") was put under the library/ directory which is
not by default searchable from elementpath_overlay. This patch works around
the issue by adding that path to sys.path.

Also fix a typo in the RDT checking assertion.

Tracked-On: #6690
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
Junjie Mao 2022-06-13 18:23:24 +08:00 committed by acrnsi-robot
parent 30fd08b1a4
commit 256dd158c3
5 changed files with 21 additions and 10 deletions

View File

@ -8,7 +8,7 @@ from scenario_config.default_populator import DefaultValuePopulatingStage
from scenario_config.pipeline import PipelineObject, PipelineEngine from scenario_config.pipeline import PipelineObject, PipelineEngine
from scenario_config.validator import ValidatorConstructionByFileStage, SemanticValidationStage, \ from scenario_config.validator import ValidatorConstructionByFileStage, SemanticValidationStage, \
SyntacticValidationStage SyntacticValidationStage
from scenario_config.xml_loader import XMLLoadStage from scenario_config.xml_loader import LXMLLoadStage
from .pyodide import ( from .pyodide import (
convert_result, write_temp_file, convert_result, write_temp_file,
@ -22,10 +22,10 @@ def main(board, scenario):
pipeline = PipelineEngine(["board_path", "scenario_path", "schema_path", "datachecks_path"]) pipeline = PipelineEngine(["board_path", "scenario_path", "schema_path", "datachecks_path"])
stages = [ stages = [
ValidatorConstructionByFileStage(), ValidatorConstructionByFileStage(),
XMLLoadStage("schema"), LXMLLoadStage("schema"),
XMLLoadStage("board"), LXMLLoadStage("board"),
XMLLoadStage("scenario"), LXMLLoadStage("scenario"),
DefaultValuePopulatingStage(), DefaultValuePopulatingStage(),
SyntacticValidationStage(), SyntacticValidationStage(),
SemanticValidationStage(), SemanticValidationStage(),

View File

@ -0,0 +1,6 @@
# Copyright (C) 2022 Intel Corporation.
#
# SPDX-License-Identifier: BSD-3-Clause
# Do Not Delete
# This file be used in configurator's wasm python env

View File

@ -6,12 +6,18 @@
# SPDX-License-Identifier: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause
# #
import sys, os
from decimal import Decimal from decimal import Decimal
from copy import copy from copy import copy
import operator import operator
import rdt
import elementpath import elementpath
# Allow this script to find the library module at misc/config_tools/library.
#
# TODO: Reshuffle the module structure of the configuration toolset for clearer imports.
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
import library.rdt as rdt
BaseParser = elementpath.XPath2Parser BaseParser = elementpath.XPath2Parser
class CustomParser(BaseParser): class CustomParser(BaseParser):

View File

@ -262,7 +262,6 @@ def validate_all(validation_pipeline, pipeline_obj, data_dir):
return nr_all_errors return nr_all_errors
def main(args): def main(args):
from xml_loader import XMLLoadStage
from lxml_loader import LXMLLoadStage from lxml_loader import LXMLLoadStage
validator_construction_pipeline = PipelineEngine(["schema_path", "datachecks_path"]) validator_construction_pipeline = PipelineEngine(["schema_path", "datachecks_path"])
@ -275,8 +274,8 @@ def main(args):
validation_pipeline = PipelineEngine(["board_path", "scenario_path", "schema_etree", "validator"]) validation_pipeline = PipelineEngine(["board_path", "scenario_path", "schema_etree", "validator"])
validation_pipeline.add_stages([ validation_pipeline.add_stages([
XMLLoadStage("board"), LXMLLoadStage("board"),
XMLLoadStage("scenario"), LXMLLoadStage("scenario"),
DefaultValuePopulatingStage(), DefaultValuePopulatingStage(),
SyntacticValidationStage(), SyntacticValidationStage(),
SemanticValidationStage(), SemanticValidationStage(),

View File

@ -91,7 +91,7 @@ This error cannot be fixed by adjusting the configuration. Report a `GitHub issu
<xs:assert test="every $needed in number-of-clos-id-needed(/acrn-config) satisfies <xs:assert test="every $needed in number-of-clos-id-needed(/acrn-config) satisfies
every $capacity in min(//caches/cache/capability[@id='CAT']/clos_number) satisfies every $capacity in min(//caches/cache/capability[@id='CAT']/clos_number) satisfies
$needed &lt; 0"> $needed &lt; $capacity">
<xs:annotation acrn:severity="error" acrn:report-on="/acrn-config/hv/CACHE_REGION"> <xs:annotation acrn:severity="error" acrn:report-on="/acrn-config/hv/CACHE_REGION">
<xs:documentation>The current CAT configuration requires {string($needed)} CLOS IDs, which exceeds the capacity of the platform which supports {string($capacity)} at most.</xs:documentation> <xs:documentation>The current CAT configuration requires {string($needed)} CLOS IDs, which exceeds the capacity of the platform which supports {string($capacity)} at most.</xs:documentation>
</xs:annotation> </xs:annotation>