diff mbox

tests: Add storagevol tests for format=iso

Message ID e4ecd00762273240b1f23c00163991f5d4be349c.1488902382.git.crobinso@redhat.com
State Accepted
Commit 0de1066fb92c1c19ee3055bf94e6731299bac987
Headers show

Commit Message

Cole Robinson March 7, 2017, 3:59 p.m. UTC
Demonstrates the bug fix in commit 0e5db762627
---
 tests/storagevolxml2argvdata/iso-input.argv |  1 +
 tests/storagevolxml2argvdata/iso.argv       |  1 +
 tests/storagevolxml2argvtest.c              |  7 +++++++
 tests/storagevolxml2xmlin/vol-file-iso.xml  | 10 ++++++++++
 tests/storagevolxml2xmlout/vol-file-iso.xml | 11 +++++++++++
 tests/storagevolxml2xmltest.c               |  1 +
 6 files changed, 31 insertions(+)
 create mode 100644 tests/storagevolxml2argvdata/iso-input.argv
 create mode 100644 tests/storagevolxml2argvdata/iso.argv
 create mode 100644 tests/storagevolxml2xmlin/vol-file-iso.xml
 create mode 100644 tests/storagevolxml2xmlout/vol-file-iso.xml

-- 
2.9.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Comments

Pavel Hrdina March 8, 2017, 6:01 p.m. UTC | #1
On Tue, Mar 07, 2017 at 10:59:42AM -0500, Cole Robinson wrote:
> Demonstrates the bug fix in commit 0e5db762627

> ---

>  tests/storagevolxml2argvdata/iso-input.argv |  1 +

>  tests/storagevolxml2argvdata/iso.argv       |  1 +

>  tests/storagevolxml2argvtest.c              |  7 +++++++

>  tests/storagevolxml2xmlin/vol-file-iso.xml  | 10 ++++++++++

>  tests/storagevolxml2xmlout/vol-file-iso.xml | 11 +++++++++++

>  tests/storagevolxml2xmltest.c               |  1 +

>  6 files changed, 31 insertions(+)

>  create mode 100644 tests/storagevolxml2argvdata/iso-input.argv

>  create mode 100644 tests/storagevolxml2argvdata/iso.argv

>  create mode 100644 tests/storagevolxml2xmlin/vol-file-iso.xml

>  create mode 100644 tests/storagevolxml2xmlout/vol-file-iso.xml

> 

> diff --git a/tests/storagevolxml2argvdata/iso-input.argv b/tests/storagevolxml2argvdata/iso-input.argv

> new file mode 100644

> index 0000000..333d7e6

> --- /dev/null

> +++ b/tests/storagevolxml2argvdata/iso-input.argv

> @@ -0,0 +1 @@

> +qemu-img convert -f raw -O raw /var/lib/libvirt/images/test.iso /var/lib/libvirt/images/sparse.img


This line is too long and syntax-check isn't happy about that.

> \ No newline at end of file

> diff --git a/tests/storagevolxml2argvdata/iso.argv b/tests/storagevolxml2argvdata/iso.argv

> new file mode 100644

> index 0000000..40b99c5

> --- /dev/null

> +++ b/tests/storagevolxml2argvdata/iso.argv

> @@ -0,0 +1 @@

> +qemu-img create -f raw /var/lib/libvirt/images/test.iso 1024K

> \ No newline at end of file


For some reason both .argv files have no "\n" at the end of a file,
reported by syntax-check.

ACK with that fixed.

Pavel
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff mbox

Patch

diff --git a/tests/storagevolxml2argvdata/iso-input.argv b/tests/storagevolxml2argvdata/iso-input.argv
new file mode 100644
index 0000000..333d7e6
--- /dev/null
+++ b/tests/storagevolxml2argvdata/iso-input.argv
@@ -0,0 +1 @@ 
+qemu-img convert -f raw -O raw /var/lib/libvirt/images/test.iso /var/lib/libvirt/images/sparse.img
\ No newline at end of file
diff --git a/tests/storagevolxml2argvdata/iso.argv b/tests/storagevolxml2argvdata/iso.argv
new file mode 100644
index 0000000..40b99c5
--- /dev/null
+++ b/tests/storagevolxml2argvdata/iso.argv
@@ -0,0 +1 @@ 
+qemu-img create -f raw /var/lib/libvirt/images/test.iso 1024K
\ No newline at end of file
diff --git a/tests/storagevolxml2argvtest.c b/tests/storagevolxml2argvtest.c
index bf9dbe5..24c3bac 100644
--- a/tests/storagevolxml2argvtest.c
+++ b/tests/storagevolxml2argvtest.c
@@ -272,6 +272,13 @@  mymain(void)
                  "pool-dir", "vol-qcow2-nocapacity-backing", NULL, NULL,
                  "qcow2-nocapacity", 0, FMT_OPTIONS);
 
+    DO_TEST("pool-dir", "vol-file-iso",
+            NULL, NULL,
+            "iso", 0, FMT_OPTIONS);
+    DO_TEST("pool-dir", "vol-file",
+            "pool-dir", "vol-file-iso",
+            "iso-input", 0, FMT_OPTIONS);
+
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
 
diff --git a/tests/storagevolxml2xmlin/vol-file-iso.xml b/tests/storagevolxml2xmlin/vol-file-iso.xml
new file mode 100644
index 0000000..b1f0756
--- /dev/null
+++ b/tests/storagevolxml2xmlin/vol-file-iso.xml
@@ -0,0 +1,10 @@ 
+<volume>
+  <name>test.iso</name>
+  <source/>
+  <capacity unit="MiB">1</capacity>
+  <allocation unit="MiB">1</allocation>
+  <target>
+    <format type='iso'/>
+    <path>/var/lib/libvirt/images/test.iso</path>
+  </target>
+</volume>
diff --git a/tests/storagevolxml2xmlout/vol-file-iso.xml b/tests/storagevolxml2xmlout/vol-file-iso.xml
new file mode 100644
index 0000000..9783124
--- /dev/null
+++ b/tests/storagevolxml2xmlout/vol-file-iso.xml
@@ -0,0 +1,11 @@ 
+<volume type='file'>
+  <name>test.iso</name>
+  <source>
+  </source>
+  <capacity unit='bytes'>1048576</capacity>
+  <allocation unit='bytes'>1048576</allocation>
+  <target>
+    <path>/var/lib/libvirt/images/test.iso</path>
+    <format type='iso'/>
+  </target>
+</volume>
diff --git a/tests/storagevolxml2xmltest.c b/tests/storagevolxml2xmltest.c
index db82bea..18e8016 100644
--- a/tests/storagevolxml2xmltest.c
+++ b/tests/storagevolxml2xmltest.c
@@ -100,6 +100,7 @@  mymain(void)
     DO_TEST("pool-dir", "vol-file");
     DO_TEST("pool-dir", "vol-file-naming");
     DO_TEST("pool-dir", "vol-file-backing");
+    DO_TEST("pool-dir", "vol-file-iso");
     DO_TEST("pool-dir", "vol-qcow2");
     DO_TEST("pool-dir", "vol-qcow2-1.1");
     DO_TEST("pool-dir", "vol-qcow2-lazy");