mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-22 05:30:24 +00:00
Revert "config_tools: add SyntacticValidationStage before save scenario"
This reverts commit 68636087a6
.
Tracked-On: #6691
Signed-off-by: Weiyi Feng <weiyix.feng@intel.com>
This commit is contained in:
parent
c24515cb7c
commit
753b2cf2c3
@ -39,8 +39,8 @@ class PythonObject {
|
|||||||
return this.api('validateScenarioStructure', 'plaintext', scenarioXMLText)
|
return this.api('validateScenarioStructure', 'plaintext', scenarioXMLText)
|
||||||
}
|
}
|
||||||
|
|
||||||
validateScenario(boardXMLText, scenarioXMLText, completed_verify = false) {
|
validateScenario(boardXMLText, scenarioXMLText) {
|
||||||
return this.api('validateScenario', 'json', boardXMLText, scenarioXMLText, completed_verify)
|
return this.api('validateScenario', 'json', boardXMLText, scenarioXMLText)
|
||||||
}
|
}
|
||||||
|
|
||||||
generateLaunchScript(boardXMLText, scenarioXMLText) {
|
generateLaunchScript(boardXMLText, scenarioXMLText) {
|
||||||
|
@ -114,7 +114,6 @@ export default {
|
|||||||
window.getCurrentFormSchemaData = this.getCurrentFormSchemaData
|
window.getCurrentFormSchemaData = this.getCurrentFormSchemaData
|
||||||
window.getCurrentScenarioData = this.getCurrentScenarioData
|
window.getCurrentScenarioData = this.getCurrentScenarioData
|
||||||
window.getBoardData = this.getBoardData
|
window.getBoardData = this.getBoardData
|
||||||
window.getErrors = this.getErrors
|
|
||||||
this.showFlag = this.isNewConfig === 'true'
|
this.showFlag = this.isNewConfig === 'true'
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -143,9 +142,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getErrors() {
|
|
||||||
return this.errors
|
|
||||||
},
|
|
||||||
back() {
|
back() {
|
||||||
this.$router.back()
|
this.$router.back()
|
||||||
},
|
},
|
||||||
@ -220,11 +216,7 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
if (this.schemas.ServiceVM.BasicConfigType.properties.hasOwnProperty('vm_type') === false) {
|
if (this.schemas.ServiceVM.BasicConfigType.properties.hasOwnProperty('vm_type') === false) {
|
||||||
this.schemas.ServiceVM.BasicConfigType.properties.vm_type =
|
this.schemas.ServiceVM.BasicConfigType.properties.vm_type =
|
||||||
{
|
{$ref: '#/definitions/BasicVMType', title: 'VM type', description: '<p>Select the VM type. A standard VM (<span class=…ial features for time-sensitive applications.</p>'}
|
||||||
$ref: '#/definitions/BasicVMType',
|
|
||||||
title: 'VM type',
|
|
||||||
description: '<p>Select the VM type. A standard VM (<span class=…ial features for time-sensitive applications.</p>'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -387,33 +379,11 @@ export default {
|
|||||||
let scenarioWithDefault = configurator.pythonObject.populateDefaultValues(scenarioXMLData)
|
let scenarioWithDefault = configurator.pythonObject.populateDefaultValues(scenarioXMLData)
|
||||||
scenarioWithDefault = scenarioWithDefault.json['acrn-config']
|
scenarioWithDefault = scenarioWithDefault.json['acrn-config']
|
||||||
|
|
||||||
if ((!scenarioWithDefault.hv.FEATURES.hasOwnProperty('RDT')) || scenarioWithDefault.hv.FEATURES.RDT.RDT_ENABLED === 'n') {
|
if (scenarioWithDefault.hv.FEATURES.RDT.RDT_ENABLED === 'n') {
|
||||||
delete scenarioWithDefault.hv.CACHE_REGION
|
delete scenarioWithDefault.hv.CACHE_REGION
|
||||||
}
|
}
|
||||||
return scenarioWithDefault
|
return scenarioWithDefault
|
||||||
},
|
},
|
||||||
translateErrors() {
|
|
||||||
let messageRegex = [
|
|
||||||
{
|
|
||||||
regex: /The content of element '(.+?)' is not complete. Tag '(.+?)' expected./,
|
|
||||||
replace: '"$2" field in "$1" is required.'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
regex: /Unexpected child with tag 'VBDF' at position 1. Tag 'VM_NAME' expected./,
|
|
||||||
replace: '"VM name" in "InterVM shared memory region" is required.'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
const translate = (error) => {
|
|
||||||
for (const messageRegexKey in messageRegex) {
|
|
||||||
if (messageRegex[messageRegexKey].regex.test(error.message)) {
|
|
||||||
error.message = error.message.replace(messageRegex[messageRegexKey].regex, messageRegex[messageRegexKey].replace)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.errors.map((error) => {
|
|
||||||
translate(error)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
saveScenario() {
|
saveScenario() {
|
||||||
if (_.isEmpty(this.scenario.vm)) {
|
if (_.isEmpty(this.scenario.vm)) {
|
||||||
alert("Please add at least one VM")
|
alert("Please add at least one VM")
|
||||||
@ -454,21 +424,13 @@ export default {
|
|||||||
}
|
}
|
||||||
// begin write down and verify
|
// begin write down and verify
|
||||||
|
|
||||||
this.errors = configurator.pythonObject.validateScenario(this.board.content, scenarioXMLData, false)
|
|
||||||
// noinspection ExceptionCaughtLocallyJS
|
|
||||||
if (this.errors.length !== 0) {
|
|
||||||
this.translateErrors()
|
|
||||||
alert('Scenario have struct error, save failed!')
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
configurator.writeFile(this.WorkingFolder + 'scenario.xml', scenarioXMLData)
|
configurator.writeFile(this.WorkingFolder + 'scenario.xml', scenarioXMLData)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
stepDone = 1
|
stepDone = 1
|
||||||
console.log("validate settings...")
|
console.log("validate settings...")
|
||||||
this.errors = configurator.pythonObject.validateScenario(this.board.content, scenarioXMLData, true)
|
this.errors = configurator.pythonObject.validateScenario(this.board.content, scenarioXMLData)
|
||||||
// noinspection ExceptionCaughtLocallyJS
|
// noinspection ExceptionCaughtLocallyJS
|
||||||
if (this.errors.length !== 0) {
|
if (this.errors.length !== 0) {
|
||||||
this.translateErrors()
|
|
||||||
throw new Error("validation failed")
|
throw new Error("validation failed")
|
||||||
}
|
}
|
||||||
console.log("validation ok")
|
console.log("validation ok")
|
||||||
@ -482,6 +444,8 @@ export default {
|
|||||||
writeDone.push(configurator.writeFile(this.WorkingFolder + filename, launchScripts[filename]))
|
writeDone.push(configurator.writeFile(this.WorkingFolder + filename, launchScripts[filename]))
|
||||||
}
|
}
|
||||||
return Promise.all(writeDone)
|
return Promise.all(writeDone)
|
||||||
|
} else {
|
||||||
|
return
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
|
@ -12,11 +12,13 @@ from scenario_config.xml_loader import XMLLoadStage
|
|||||||
|
|
||||||
from .pyodide import (
|
from .pyodide import (
|
||||||
convert_result, write_temp_file,
|
convert_result, write_temp_file,
|
||||||
|
# Todo: add debug switch
|
||||||
|
# is_debug,
|
||||||
nuc11_board, nuc11_scenario, scenario_xml_schema_path, datachecks_xml_schema_path
|
nuc11_board, nuc11_scenario, scenario_xml_schema_path, datachecks_xml_schema_path
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def main(board, scenario, completed_verify=False):
|
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(),
|
||||||
@ -25,10 +27,11 @@ def main(board, scenario, completed_verify=False):
|
|||||||
XMLLoadStage("board"),
|
XMLLoadStage("board"),
|
||||||
XMLLoadStage("scenario"),
|
XMLLoadStage("scenario"),
|
||||||
DefaultValuePopulatingStage(),
|
DefaultValuePopulatingStage(),
|
||||||
SyntacticValidationStage()
|
SemanticValidationStage(),
|
||||||
]
|
]
|
||||||
if completed_verify:
|
#
|
||||||
stages.append(SemanticValidationStage())
|
# if is_debug:
|
||||||
|
# stages.append(SyntacticValidationStage())
|
||||||
|
|
||||||
pipeline.add_stages(stages)
|
pipeline.add_stages(stages)
|
||||||
with TemporaryDirectory() as tmpdir:
|
with TemporaryDirectory() as tmpdir:
|
||||||
@ -47,9 +50,7 @@ def main(board, scenario, completed_verify=False):
|
|||||||
)
|
)
|
||||||
pipeline.run(obj)
|
pipeline.run(obj)
|
||||||
|
|
||||||
validate_result: list = obj.get("syntactic_errors")
|
validate_result = obj.get("semantic_errors")
|
||||||
if completed_verify:
|
|
||||||
validate_result.extend(obj.get("semantic_errors"))
|
|
||||||
return convert_result(validate_result)
|
return convert_result(validate_result)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user