[libvirt] [PATCH] Domain snapshot RNG and tests.

Chris Lalancette clalance at redhat.com
Thu May 20 15:14:02 UTC 2010


Signed-off-by: Chris Lalancette <clalance at redhat.com>
---
 docs/schemas/domainsnapshot.rng                    |   53 ++++++++++++++++++++
 tests/Makefile.am                                  |    6 ++-
 tests/domainsnapshotschematest                     |   10 ++++
 tests/domainsnapshotxml2xmlin/description_only.xml |    3 +
 tests/domainsnapshotxml2xmlin/empty.xml            |    1 +
 .../name_and_description.xml                       |    4 ++
 tests/domainsnapshotxml2xmlin/name_only.xml        |    3 +
 tests/domainsnapshotxml2xmlout/all_parameters.xml  |   13 +++++
 tests/domainsnapshotxml2xmlout/noparent.xml        |    9 +++
 .../noparent_nodescription.xml                     |    7 +++
 .../noparent_nodescription_noactive.xml            |    6 ++
 11 files changed, 114 insertions(+), 1 deletions(-)
 create mode 100644 docs/schemas/domainsnapshot.rng
 create mode 100755 tests/domainsnapshotschematest
 create mode 100644 tests/domainsnapshotxml2xmlin/description_only.xml
 create mode 100644 tests/domainsnapshotxml2xmlin/empty.xml
 create mode 100644 tests/domainsnapshotxml2xmlin/name_and_description.xml
 create mode 100644 tests/domainsnapshotxml2xmlin/name_only.xml
 create mode 100644 tests/domainsnapshotxml2xmlout/all_parameters.xml
 create mode 100644 tests/domainsnapshotxml2xmlout/noparent.xml
 create mode 100644 tests/domainsnapshotxml2xmlout/noparent_nodescription.xml
 create mode 100644 tests/domainsnapshotxml2xmlout/noparent_nodescription_noactive.xml

diff --git a/docs/schemas/domainsnapshot.rng b/docs/schemas/domainsnapshot.rng
new file mode 100644
index 0000000..86bab0b
--- /dev/null
+++ b/docs/schemas/domainsnapshot.rng
@@ -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>
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c5e52e3..caf8cd0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -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
index 0000000..1bdc539
--- /dev/null
+++ b/tests/domainsnapshotschematest
@@ -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
index 0000000..b76fca2
--- /dev/null
+++ b/tests/domainsnapshotxml2xmlin/description_only.xml
@@ -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
index 0000000..f2bcfbe
--- /dev/null
+++ b/tests/domainsnapshotxml2xmlin/empty.xml
@@ -0,0 +1 @@
+<domainsnapshot/>
diff --git a/tests/domainsnapshotxml2xmlin/name_and_description.xml b/tests/domainsnapshotxml2xmlin/name_and_description.xml
new file mode 100644
index 0000000..90ce774
--- /dev/null
+++ b/tests/domainsnapshotxml2xmlin/name_and_description.xml
@@ -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
index 0000000..8123a02
--- /dev/null
+++ b/tests/domainsnapshotxml2xmlin/name_only.xml
@@ -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
index 0000000..ed4a600
--- /dev/null
+++ b/tests/domainsnapshotxml2xmlout/all_parameters.xml
@@ -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
index 0000000..cbac0d8
--- /dev/null
+++ b/tests/domainsnapshotxml2xmlout/noparent.xml
@@ -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
index 0000000..0de202d
--- /dev/null
+++ b/tests/domainsnapshotxml2xmlout/noparent_nodescription.xml
@@ -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
index 0000000..25b60f3
--- /dev/null
+++ b/tests/domainsnapshotxml2xmlout/noparent_nodescription_noactive.xml
@@ -0,0 +1,6 @@
+<domainsnapshot>
+  <name>my snap name</name>
+  <description>!@#$%^</description>
+  <state>running</state>
+  <creationTime>1272917631</creationTime>
+</domainsnapshot>
-- 
1.6.6.1




More information about the libvir-list mailing list