From eb467df66896ae6e9cc99034d5c951fde01ff931 Mon Sep 17 00:00:00 2001
Message-Id: <eb467df66896ae6e9cc99034d5c951fde01ff931@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 26 Feb 2014 14:55:07 +0100
Subject: [PATCH] domainsnapshotxml2xmltest: Add existing files as new tests
https://bugzilla.redhat.com/show_bug.cgi?id=1032370
There were plenty snapshot XMLs in the tests/domainsnapshotxml2xmlin
directory that actually weren't used in XML testing. The upgraded
domainsnapshotxml2xml test now allows us to use them.
(cherry picked from commit a686115cba0f9ed3a686fb28d6faa4bcea618f8e)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
tests/domainsnapshotxml2xmlin/external_vm.xml | 1 -
tests/domainsnapshotxml2xmlin/noparent.xml | 1 +
tests/domainsnapshotxml2xmlout/disk_snapshot.xml | 15 +++++++++++++++
tests/domainsnapshotxml2xmlout/empty.xml | 8 ++++++++
tests/domainsnapshotxml2xmlout/external_vm.xml | 5 +++++
tests/domainsnapshotxml2xmlout/name_and_description.xml | 5 +++++
tests/domainsnapshotxml2xmlout/noparent.xml | 2 +-
tests/domainsnapshotxml2xmltest.c | 10 ++++++++++
8 files changed, 45 insertions(+), 2 deletions(-)
create mode 100644 tests/domainsnapshotxml2xmlout/disk_snapshot.xml
create mode 100644 tests/domainsnapshotxml2xmlout/empty.xml
create mode 100644 tests/domainsnapshotxml2xmlout/external_vm.xml
create mode 100644 tests/domainsnapshotxml2xmlout/name_and_description.xml
diff --git a/tests/domainsnapshotxml2xmlin/external_vm.xml b/tests/domainsnapshotxml2xmlin/external_vm.xml
index 3bcd150..6be626c 100644
--- a/tests/domainsnapshotxml2xmlin/external_vm.xml
+++ b/tests/domainsnapshotxml2xmlin/external_vm.xml
@@ -6,5 +6,4 @@
<parent>
<name>earlier_snap</name>
</parent>
- <creationTime>1272917631</creationTime>
</domainsnapshot>
diff --git a/tests/domainsnapshotxml2xmlin/noparent.xml b/tests/domainsnapshotxml2xmlin/noparent.xml
index cbac0d8..672a0af 100644
--- a/tests/domainsnapshotxml2xmlin/noparent.xml
+++ b/tests/domainsnapshotxml2xmlin/noparent.xml
@@ -2,6 +2,7 @@
<name>my snap name</name>
<description>!@#$%^</description>
<state>running</state>
+ <memory snapshot='internal'/>
<creationTime>1272917631</creationTime>
<domain>
<uuid>9d37b878-a7cc-9f9a-b78f-49b3abad25a8</uuid>
diff --git a/tests/domainsnapshotxml2xmlout/disk_snapshot.xml b/tests/domainsnapshotxml2xmlout/disk_snapshot.xml
new file mode 100644
index 0000000..1a1fc02
--- /dev/null
+++ b/tests/domainsnapshotxml2xmlout/disk_snapshot.xml
@@ -0,0 +1,15 @@
+<domainsnapshot>
+ <name>my snap name</name>
+ <description>!@#$%^</description>
+ <disks>
+ <disk name='/dev/HostVG/QEMUGuest1'/>
+ <disk name='hdb' snapshot='no'/>
+ <disk name='hdc' snapshot='internal'/>
+ <disk name='hdd' snapshot='external'>
+ <driver type='qed'/>
+ </disk>
+ <disk name='hde' snapshot='external'>
+ <source file='/path/to/new'/>
+ </disk>
+ </disks>
+</domainsnapshot>
diff --git a/tests/domainsnapshotxml2xmlout/empty.xml b/tests/domainsnapshotxml2xmlout/empty.xml
new file mode 100644
index 0000000..41538f7
--- /dev/null
+++ b/tests/domainsnapshotxml2xmlout/empty.xml
@@ -0,0 +1,8 @@
+<domainsnapshot>
+ <name>1386166249</name>
+ <state>nostate</state>
+ <creationTime>1386166249</creationTime>
+ <domain>
+ <uuid>9d37b878-a7cc-9f9a-b78f-49b3abad25a8</uuid>
+ </domain>
+</domainsnapshot>
diff --git a/tests/domainsnapshotxml2xmlout/external_vm.xml b/tests/domainsnapshotxml2xmlout/external_vm.xml
new file mode 100644
index 0000000..9da369b
--- /dev/null
+++ b/tests/domainsnapshotxml2xmlout/external_vm.xml
@@ -0,0 +1,5 @@
+<domainsnapshot>
+ <name>my snap name</name>
+ <description>!@#$%^</description>
+ <memory snapshot='external' file='/dev/HostVG/GuestMemory'/>
+</domainsnapshot>
diff --git a/tests/domainsnapshotxml2xmlout/name_and_description.xml b/tests/domainsnapshotxml2xmlout/name_and_description.xml
new file mode 100644
index 0000000..435ab79
--- /dev/null
+++ b/tests/domainsnapshotxml2xmlout/name_and_description.xml
@@ -0,0 +1,5 @@
+<domainsnapshot>
+ <name>snap1</name>
+ <description>A longer description!</description>
+ <state>nostate</state>
+</domainsnapshot>
diff --git a/tests/domainsnapshotxml2xmlout/noparent.xml b/tests/domainsnapshotxml2xmlout/noparent.xml
index 0cbbb65..d4360f0 100644
--- a/tests/domainsnapshotxml2xmlout/noparent.xml
+++ b/tests/domainsnapshotxml2xmlout/noparent.xml
@@ -1,7 +1,7 @@
<domainsnapshot>
<name>my snap name</name>
<description>!@#$%^</description>
- <state>running</state>
+ <state>nostate</state>
<creationTime>1272917631</creationTime>
<memory snapshot='internal'/>
<domain>
diff --git a/tests/domainsnapshotxml2xmltest.c b/tests/domainsnapshotxml2xmltest.c
index 4a1fcce..7870601 100644
--- a/tests/domainsnapshotxml2xmltest.c
+++ b/tests/domainsnapshotxml2xmltest.c
@@ -215,6 +215,16 @@ mymain(void)
DO_TEST_OUT("metadata", "c7a5fdbd-edaf-9455-926a-d65c16db1809", false);
DO_TEST_OUT("external_vm_redefine", "c7a5fdbd-edaf-9455-926a-d65c16db1809", false);
+ DO_TEST_INOUT("empty", "9d37b878-a7cc-9f9a-b78f-49b3abad25a8", false, false);
+ DO_TEST_INOUT("noparent", "9d37b878-a7cc-9f9a-b78f-49b3abad25a8", false, false);
+ DO_TEST_INOUT("external_vm", NULL, false, false);
+ DO_TEST_INOUT("noparent", "9d37b878-a7cc-9f9a-b78f-49b3abad25a8", false, false);
+ DO_TEST_INOUT("disk_snapshot", NULL, false, false);
+
+ DO_TEST_IN("name_and_description", NULL);
+ DO_TEST_IN("description_only", NULL);
+ DO_TEST_IN("name_only", NULL);
+
cleanup:
if (testSnapshotXMLVariableLineRegex)
regfree(testSnapshotXMLVariableLineRegex);
--
1.9.0