config_tools: add schema of checker schemas

This patch adds a (meta) XML schema of those XML schema files specifying
the validation rules (using xs:assert constructs). This provide integrators
with a mechanism to confirm the well-formedness of those rules, especially
the customized annotations for advanced error reporting.

Tracked-On: #6690
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
Junjie Mao 2022-02-07 18:06:23 +08:00 committed by acrnsi-robot
parent e266ab2649
commit cfcea64976
3 changed files with 68 additions and 0 deletions

View File

@ -0,0 +1,9 @@
#!/bin/bash
# Copyright (C) 2022 Intel Corporation.
# SPDX-License-Identifier: BSD-3-Clause
checks_dir=$(dirname $0)
for checker in ${checks_dir}/*.xsd; do
xmllint --noout --schema ${checks_dir}/schema_of_checks/main.xsd ${checker}
done

View File

@ -0,0 +1,18 @@
<?xml version="1.0"?>
<!-- Copyright (C) 2022 Intel Corporation. -->
<!-- SPDX-License-Identifier: BSD-3-Clause -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="https://projectacrn.org">
<xs:attribute name="severity">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="error" />
<xs:enumeration value="warning" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="report-on" type="xs:string" />
</xs:schema>

View File

@ -0,0 +1,41 @@
<?xml version="1.0"?>
<!-- Copyright (C) 2022 Intel Corporation. -->
<!-- SPDX-License-Identifier: BSD-3-Clause -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:acrn="https://projectacrn.org"
targetNamespace="http://www.w3.org/2001/XMLSchema">
<xs:import namespace="https://projectacrn.org" schemaLocation="custom_annot.xsd" />
<xs:element name="documentation" type="xs:string" />
<xs:element name="annotation">
<xs:complexType>
<xs:sequence>
<xs:element ref="xs:documentation" />
</xs:sequence>
<xs:attribute ref="acrn:severity" />
<xs:attribute ref="acrn:report-on" />
</xs:complexType>
</xs:element>
<xs:element name="assert">
<xs:complexType>
<xs:sequence>
<xs:element ref="xs:annotation" />
</xs:sequence>
<xs:attribute name="test" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="schema">
<xs:complexType>
<xs:sequence>
<xs:element ref="xs:assert" maxOccurs="unbounded" />
</xs:sequence>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
</xs:element>
</xs:schema>