mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
virschematest: Add infrastructure for testing single devices
Introduce an internal schema for a single device and use it to test the various files in tests/qemuhotplugtestdevices and tests/qemublocktestdata directories. This also requires us to implement schema for (some) privateData bits for the disk source. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
d8ceacdc87
commit
8daa94cd8e
51
tests/schemas/device.rng.in
Normal file
51
tests/schemas/device.rng.in
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
||||||
|
<include href="privatedata.rng"/>
|
||||||
|
<include href="@SCHEMADIR@/domainoverrides.rng"/>
|
||||||
|
|
||||||
|
<!-- This schema file describes a singular device. -->
|
||||||
|
|
||||||
|
<!-- allow also disk definitions without 'target' as they are used in some tests -->
|
||||||
|
<define name="diskTarget" combine="choice">
|
||||||
|
<optional>
|
||||||
|
<element name="target">
|
||||||
|
<empty/>
|
||||||
|
</element>
|
||||||
|
</optional>
|
||||||
|
</define>
|
||||||
|
|
||||||
|
<start>
|
||||||
|
<choice>
|
||||||
|
<ref name="disk"/>
|
||||||
|
<ref name="controller"/>
|
||||||
|
<ref name="lease"/>
|
||||||
|
<ref name="filesystem"/>
|
||||||
|
<ref name="interface"/>
|
||||||
|
<ref name="input"/>
|
||||||
|
<ref name="sound"/>
|
||||||
|
<ref name="audio"/>
|
||||||
|
<ref name="hostdev"/>
|
||||||
|
<ref name="graphic"/>
|
||||||
|
<ref name="video"/>
|
||||||
|
<ref name="console"/>
|
||||||
|
<ref name="parallel"/>
|
||||||
|
<ref name="serial"/>
|
||||||
|
<ref name="channel"/>
|
||||||
|
<ref name="smartcard"/>
|
||||||
|
<ref name="hub"/>
|
||||||
|
<ref name="redirdev"/>
|
||||||
|
<ref name="redirfilter"/>
|
||||||
|
<ref name="rng"/>
|
||||||
|
<ref name="tpm"/>
|
||||||
|
<ref name="shmem"/>
|
||||||
|
<ref name="memorydev"/>
|
||||||
|
<ref name="watchdog"/>
|
||||||
|
<ref name="memballoon"/>
|
||||||
|
<ref name="nvram"/>
|
||||||
|
<ref name="panic"/>
|
||||||
|
<ref name="iommu"/>
|
||||||
|
<ref name="vsock"/>
|
||||||
|
</choice>
|
||||||
|
</start>
|
||||||
|
|
||||||
|
</grammar>
|
@ -5,6 +5,8 @@ virschematest_test_schemas_conf = configuration_data({
|
|||||||
|
|
||||||
virschematest_schemas = [
|
virschematest_schemas = [
|
||||||
'cpu-baseline.rng.in',
|
'cpu-baseline.rng.in',
|
||||||
|
'device.rng.in',
|
||||||
|
'privatedata.rng.in',
|
||||||
]
|
]
|
||||||
|
|
||||||
foreach file : virschematest_schemas
|
foreach file : virschematest_schemas
|
||||||
|
68
tests/schemas/privatedata.rng.in
Normal file
68
tests/schemas/privatedata.rng.in
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
||||||
|
|
||||||
|
<define name="privateDataStorageSource" combine="choice">
|
||||||
|
<optional>
|
||||||
|
<element name="privateData">
|
||||||
|
<interleave>
|
||||||
|
<optional>
|
||||||
|
<ref name="privateDataStorageSourceNodenames"/>
|
||||||
|
</optional>
|
||||||
|
<optional>
|
||||||
|
<ref name="privateDataStorageSourceReservations"/>
|
||||||
|
</optional>
|
||||||
|
<optional>
|
||||||
|
<ref name="privateDataStorageSourceObjects"/>
|
||||||
|
</optional>
|
||||||
|
</interleave>
|
||||||
|
</element>
|
||||||
|
</optional>
|
||||||
|
</define>
|
||||||
|
|
||||||
|
<define name="privateDataDeviceDisk" combine="choice">
|
||||||
|
<optional>
|
||||||
|
<element name="privateData">
|
||||||
|
<notAllowed/>
|
||||||
|
</element>
|
||||||
|
</optional>
|
||||||
|
</define>
|
||||||
|
|
||||||
|
<define name="privateDataStorageSourceNodenames">
|
||||||
|
<element name="nodenames">
|
||||||
|
<oneOrMore>
|
||||||
|
<ref name="nodename"/>
|
||||||
|
</oneOrMore>
|
||||||
|
</element>
|
||||||
|
</define>
|
||||||
|
|
||||||
|
<define name="nodename">
|
||||||
|
<element name="nodename">
|
||||||
|
<attribute name="type">
|
||||||
|
<choice>
|
||||||
|
<value>storage</value>
|
||||||
|
<value>format</value>
|
||||||
|
</choice>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="name"/>
|
||||||
|
</element>
|
||||||
|
</define>
|
||||||
|
|
||||||
|
<define name="privateDataStorageSourceReservations">
|
||||||
|
<element name="reservations">
|
||||||
|
<attribute name="mgralias"/>
|
||||||
|
</element>
|
||||||
|
</define>
|
||||||
|
|
||||||
|
<define name="privateDataStorageSourceObjects">
|
||||||
|
<element name="objects">
|
||||||
|
<interleave>
|
||||||
|
<optional>
|
||||||
|
<element name="TLSx509">
|
||||||
|
<attribute name="alias"/>
|
||||||
|
</element>
|
||||||
|
</optional>
|
||||||
|
</interleave>
|
||||||
|
</element>
|
||||||
|
</define>
|
||||||
|
|
||||||
|
</grammar>
|
@ -322,6 +322,12 @@ static const struct testSchemaEntry testsCpuBaseline[] = {
|
|||||||
{ . dir = "tests/cputestdata" },
|
{ . dir = "tests/cputestdata" },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct testSchemaEntry testDevice[] = {
|
||||||
|
{ .dir = "tests/qemuhotplugtestdevices" },
|
||||||
|
{ .dir = "tests/qemublocktestdata/imagecreate" },
|
||||||
|
{ .dir = "tests/qemublocktestdata/xml2json" },
|
||||||
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mymain(void)
|
mymain(void)
|
||||||
{
|
{
|
||||||
@ -352,6 +358,7 @@ mymain(void)
|
|||||||
DO_TEST(SCHEMAS_PATH "storagevol.rng", schemaStorageVol);
|
DO_TEST(SCHEMAS_PATH "storagevol.rng", schemaStorageVol);
|
||||||
|
|
||||||
DO_TEST(INTERNAL_SCHEMAS_PATH "cpu-baseline.rng", testsCpuBaseline);
|
DO_TEST(INTERNAL_SCHEMAS_PATH "cpu-baseline.rng", testsCpuBaseline);
|
||||||
|
DO_TEST(INTERNAL_SCHEMAS_PATH "device.rng", testDevice);
|
||||||
|
|
||||||
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user