render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
c401cc
From e7d36f0981e86a7b608e228a3f766e73f0b95e10 Mon Sep 17 00:00:00 2001
c401cc
Message-Id: <e7d36f0981e86a7b608e228a3f766e73f0b95e10@dist-git>
c401cc
From: Peter Krempa <pkrempa@redhat.com>
c401cc
Date: Wed, 26 Feb 2014 14:55:08 +0100
c401cc
Subject: [PATCH] domainsnapshotxml2xmltest: Add test case for empty driver
c401cc
 element
c401cc
c401cc
https://bugzilla.redhat.com/show_bug.cgi?id=1032370
c401cc
c401cc
Commit 5a66c667ff5cae61c2ad2e646c8eb3eedc67f925 fixed a NULL dereference
c401cc
if the disk driver element was empty. Add a test for this case.
c401cc
c401cc
(cherry picked from commit 2cb2abc04d08c90e826b8341cca91e7c886f6188)
c401cc
c401cc
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c401cc
---
c401cc
 tests/domainsnapshotxml2xmlin/disk_driver_name_null.xml  | 10 ++++++++++
c401cc
 tests/domainsnapshotxml2xmlout/disk_driver_name_null.xml |  9 +++++++++
c401cc
 tests/domainsnapshotxml2xmltest.c                        |  1 +
c401cc
 3 files changed, 20 insertions(+)
c401cc
 create mode 100644 tests/domainsnapshotxml2xmlin/disk_driver_name_null.xml
c401cc
 create mode 100644 tests/domainsnapshotxml2xmlout/disk_driver_name_null.xml
c401cc
c401cc
diff --git a/tests/domainsnapshotxml2xmlin/disk_driver_name_null.xml b/tests/domainsnapshotxml2xmlin/disk_driver_name_null.xml
c401cc
new file mode 100644
c401cc
index 0000000..78eee9c
c401cc
--- /dev/null
c401cc
+++ b/tests/domainsnapshotxml2xmlin/disk_driver_name_null.xml
c401cc
@@ -0,0 +1,10 @@
c401cc
+<domainsnapshot>
c401cc
+  <name>asdf</name>
c401cc
+  <description>adsf</description>
c401cc
+  <disks>
c401cc
+    <disk name='vda' snapshot='external'>
c401cc
+      <source file='/tmp/foo'/>
c401cc
+      <driver/>
c401cc
+    </disk>
c401cc
+  </disks>
c401cc
+</domainsnapshot>
c401cc
diff --git a/tests/domainsnapshotxml2xmlout/disk_driver_name_null.xml b/tests/domainsnapshotxml2xmlout/disk_driver_name_null.xml
c401cc
new file mode 100644
c401cc
index 0000000..41961f1
c401cc
--- /dev/null
c401cc
+++ b/tests/domainsnapshotxml2xmlout/disk_driver_name_null.xml
c401cc
@@ -0,0 +1,9 @@
c401cc
+<domainsnapshot>
c401cc
+  <name>asdf</name>
c401cc
+  <description>adsf</description>
c401cc
+  <disks>
c401cc
+    <disk name='vda' snapshot='external'>
c401cc
+      <source file='/tmp/foo'/>
c401cc
+    </disk>
c401cc
+  </disks>
c401cc
+</domainsnapshot>
c401cc
diff --git a/tests/domainsnapshotxml2xmltest.c b/tests/domainsnapshotxml2xmltest.c
c401cc
index 7870601..4bf0c7c 100644
c401cc
--- a/tests/domainsnapshotxml2xmltest.c
c401cc
+++ b/tests/domainsnapshotxml2xmltest.c
c401cc
@@ -220,6 +220,7 @@ mymain(void)
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
+    DO_TEST_INOUT("disk_driver_name_null", NULL, false, false);
c401cc
 
c401cc
     DO_TEST_IN("name_and_description", NULL);
c401cc
     DO_TEST_IN("description_only", NULL);
c401cc
-- 
c401cc
1.9.0
c401cc