render / rpms / libvirt

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