]> xenbits.xensource.com Git - libvirt.git/commitdiff
Domain snapshot RNG and tests.
authorChris Lalancette <clalance@redhat.com>
Mon, 3 May 2010 21:15:18 +0000 (17:15 -0400)
committerChris Lalancette <clalance@redhat.com>
Thu, 20 May 2010 17:50:03 +0000 (13:50 -0400)
Signed-off-by: Chris Lalancette <clalance@redhat.com>
docs/schemas/domainsnapshot.rng [new file with mode: 0644]
tests/Makefile.am
tests/domainsnapshotschematest [new file with mode: 0755]
tests/domainsnapshotxml2xmlin/description_only.xml [new file with mode: 0644]
tests/domainsnapshotxml2xmlin/empty.xml [new file with mode: 0644]
tests/domainsnapshotxml2xmlin/name_and_description.xml [new file with mode: 0644]
tests/domainsnapshotxml2xmlin/name_only.xml [new file with mode: 0644]
tests/domainsnapshotxml2xmlout/all_parameters.xml [new file with mode: 0644]
tests/domainsnapshotxml2xmlout/noparent.xml [new file with mode: 0644]
tests/domainsnapshotxml2xmlout/noparent_nodescription.xml [new file with mode: 0644]
tests/domainsnapshotxml2xmlout/noparent_nodescription_noactive.xml [new file with mode: 0644]

diff --git a/docs/schemas/domainsnapshot.rng b/docs/schemas/domainsnapshot.rng
new file mode 100644 (file)
index 0000000..86bab0b
--- /dev/null
@@ -0,0 +1,53 @@
+<!-- A Relax NG schema for the libvirt domain snapshot properties XML format -->
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+  <start>
+    <ref name='domainsnapshot'/>
+  </start>
+
+  <define name='domainsnapshot'>
+    <element name='domainsnapshot'>
+      <interleave>
+        <optional>
+          <element name='name'>
+            <text/>
+          </element>
+        </optional>
+        <optional>
+          <element name='description'>
+            <text/>
+          </element>
+        </optional>
+        <optional>
+          <element name='state'>
+            <text/>
+          </element>
+        </optional>
+        <optional>
+          <element name='creationTime'>
+            <text/>
+          </element>
+        </optional>
+        <optional>
+          <element name='active'>
+            <text/>
+          </element>
+        </optional>
+        <optional>
+          <element name='domain'>
+            <element name='uuid'>
+              <text/>
+            </element>
+          </element>
+        </optional>
+        <optional>
+          <element name='parent'>
+            <element name='name'>
+              <text/>
+            </element>
+          </element>
+        </optional>
+      </interleave>
+    </element>
+  </define>
+
+</grammar>
index c5e52e3d8782b40091c3f4cc6161fcb1121d102a..caf8cd07fcd7cf22957b92e8bd9b40851e9a5f13 100644 (file)
@@ -76,6 +76,9 @@ EXTRA_DIST =          \
        nwfilterxml2xmlout \
        nwfilterxml2xmlin \
        nwfilterschematest \
+       domainsnapshotschematest \
+       domainsnapshotxml2xmlout \
+       domainsnapshotxml2xmlin \
        $(patsubst %,qemuhelpdata/%,$(qemuhelpdata))
 
 noinst_PROGRAMS = virshtest conftest \
@@ -123,7 +126,8 @@ test_scripts = \
        storagevolschematest \
        domainschematest \
        nodedevschematest \
-       nwfilterschematest
+       nwfilterschematest \
+       domainsnapshotschematest
 
 if WITH_LIBVIRTD
 test_scripts +=                                \
diff --git a/tests/domainsnapshotschematest b/tests/domainsnapshotschematest
new file mode 100755 (executable)
index 0000000..1bdc539
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+: ${srcdir=.}
+. $srcdir/test-lib.sh
+. $abs_srcdir/schematestutils.sh
+
+DIRS="domainsnapshotxml2xmlin domainsnapshotxml2xmlout"
+SCHEMA="domainsnapshot.rng"
+
+check_schema "$DIRS" "$SCHEMA"
diff --git a/tests/domainsnapshotxml2xmlin/description_only.xml b/tests/domainsnapshotxml2xmlin/description_only.xml
new file mode 100644 (file)
index 0000000..b76fca2
--- /dev/null
@@ -0,0 +1,3 @@
+<domainsnapshot>
+  <description>My description</description>
+</domainsnapshot>
diff --git a/tests/domainsnapshotxml2xmlin/empty.xml b/tests/domainsnapshotxml2xmlin/empty.xml
new file mode 100644 (file)
index 0000000..f2bcfbe
--- /dev/null
@@ -0,0 +1 @@
+<domainsnapshot/>
diff --git a/tests/domainsnapshotxml2xmlin/name_and_description.xml b/tests/domainsnapshotxml2xmlin/name_and_description.xml
new file mode 100644 (file)
index 0000000..90ce774
--- /dev/null
@@ -0,0 +1,4 @@
+<domainsnapshot>
+  <name>snap1</name>
+  <description>A longer description!</description>
+</domainsnapshot>
diff --git a/tests/domainsnapshotxml2xmlin/name_only.xml b/tests/domainsnapshotxml2xmlin/name_only.xml
new file mode 100644 (file)
index 0000000..8123a02
--- /dev/null
@@ -0,0 +1,3 @@
+<domainsnapshot>
+  <name>snapshot1</name>
+</domainsnapshot>
diff --git a/tests/domainsnapshotxml2xmlout/all_parameters.xml b/tests/domainsnapshotxml2xmlout/all_parameters.xml
new file mode 100644 (file)
index 0000000..ed4a600
--- /dev/null
@@ -0,0 +1,13 @@
+<domainsnapshot>
+  <name>my snap name</name>
+  <description>!@#$%^</description>
+  <parent>
+    <name>earlier_snap</name>
+  </parent>
+  <state>running</state>
+  <creationTime>1272917631</creationTime>
+  <domain>
+    <uuid>9d37b878-a7cc-9f9a-b78f-49b3abad25a8</uuid>
+  </domain>
+  <active>1</active>
+</domainsnapshot>
diff --git a/tests/domainsnapshotxml2xmlout/noparent.xml b/tests/domainsnapshotxml2xmlout/noparent.xml
new file mode 100644 (file)
index 0000000..cbac0d8
--- /dev/null
@@ -0,0 +1,9 @@
+<domainsnapshot>
+  <name>my snap name</name>
+  <description>!@#$%^</description>
+  <state>running</state>
+  <creationTime>1272917631</creationTime>
+  <domain>
+    <uuid>9d37b878-a7cc-9f9a-b78f-49b3abad25a8</uuid>
+  </domain>
+</domainsnapshot>
diff --git a/tests/domainsnapshotxml2xmlout/noparent_nodescription.xml b/tests/domainsnapshotxml2xmlout/noparent_nodescription.xml
new file mode 100644 (file)
index 0000000..0de202d
--- /dev/null
@@ -0,0 +1,7 @@
+<domainsnapshot>
+  <name>my snap name</name>
+  <description>!@#$%^</description>
+  <state>running</state>
+  <creationTime>1272917631</creationTime>
+  <active>1</active>
+</domainsnapshot>
diff --git a/tests/domainsnapshotxml2xmlout/noparent_nodescription_noactive.xml b/tests/domainsnapshotxml2xmlout/noparent_nodescription_noactive.xml
new file mode 100644 (file)
index 0000000..25b60f3
--- /dev/null
@@ -0,0 +1,6 @@
+<domainsnapshot>
+  <name>my snap name</name>
+  <description>!@#$%^</description>
+  <state>running</state>
+  <creationTime>1272917631</creationTime>
+</domainsnapshot>