[Libguestfs] [PATCH 2/4] tests: v2v: Rearrange test-v2v-print-source.

Richard W.M. Jones rjones at redhat.com
Thu Mar 16 18:57:13 UTC 2017


This rearranges the input files for the test of virt-v2v
--print-source, but does not change its semantics.
---
 v2v/test-v2v-print-source.expected | 14 ++++++++++++++
 v2v/test-v2v-print-source.sh       | 26 +++-----------------------
 v2v/test-v2v-print-source.xml      | 23 +++++++++++++++++++++++
 3 files changed, 40 insertions(+), 23 deletions(-)
 create mode 100644 v2v/test-v2v-print-source.expected
 create mode 100644 v2v/test-v2v-print-source.xml

diff --git a/v2v/test-v2v-print-source.expected b/v2v/test-v2v-print-source.expected
new file mode 100644
index 0000000..b947927
--- /dev/null
+++ b/v2v/test-v2v-print-source.expected
@@ -0,0 +1,14 @@
+    source name: windows
+hypervisor type: kvm
+         memory: 1073741824 (bytes)
+       nr vCPUs: 1
+   CPU features: 
+       firmware: unknown
+        display: 
+          video: qxl
+          sound: 
+disks:
+	windows.img (raw) [virtio-blk]
+removable media:
+NICs:
+	Network "default" mac: 00:11:22:33:44:55 [virtio]
diff --git a/v2v/test-v2v-print-source.sh b/v2v/test-v2v-print-source.sh
index 62899e6..c6f00a2 100755
--- a/v2v/test-v2v-print-source.sh
+++ b/v2v/test-v2v-print-source.sh
@@ -24,15 +24,12 @@ $TEST_FUNCTIONS
 skip_if_skipped
 skip_unless_phony_guest windows.img
 
-libvirt_uri="test://$abs_top_builddir/test-data/phony-guests/guests.xml"
-f=$top_builddir/test-data/phony-guests/windows.img
-
 d=test-v2v-print-source.d
 rm -rf $d
 mkdir $d
 
 $VG virt-v2v --debug-gc \
-    -i libvirt -ic "$libvirt_uri" windows \
+    -i libvirtxml test-v2v-print-source.xml \
     -o local -os $d \
     --print-source > $d/output
 
@@ -40,27 +37,10 @@ mv $d/output $d/output.orig
 < $d/output.orig \
 grep -v 'Opening the source' |
 grep -v 'Source guest information' |
-sed -e 's,/.*/,/,' |
+sed -e 's,/.*/windows.img,windows.img,' |
 grep -v '^$' \
 > $d/output
 
-if [ "$(cat $d/output)" != "    source name: windows
-hypervisor type: test
-         memory: 1073741824 (bytes)
-       nr vCPUs: 1
-   CPU features: 
-       firmware: unknown
-        display: 
-          video: qxl
-          sound: 
-disks:
-	/windows.img (raw) [virtio-blk]
-removable media:
-NICs:
-	Network \"default\" mac: 00:11:22:33:44:55 [virtio]" ]; then
-    echo "$0: unexpected output from test:"
-    cat $d/output.orig
-    exit 1
-fi
+diff -u $d/output test-v2v-print-source.expected
 
 rm -r $d
diff --git a/v2v/test-v2v-print-source.xml b/v2v/test-v2v-print-source.xml
new file mode 100644
index 0000000..0667f2e
--- /dev/null
+++ b/v2v/test-v2v-print-source.xml
@@ -0,0 +1,23 @@
+<domain type='kvm'>
+  <name>windows</name>
+  <memory>1048576</memory>
+  <os>
+    <type>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <devices>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source file='../test-data/phony-guests/windows.img'/>
+      <target dev='vda' bus='virtio'/>
+    </disk>
+    <interface type='network'>
+      <mac address='00:11:22:33:44:55'/>
+      <source network='default'/>
+      <model type='virtio'/>
+    </interface>
+    <video>
+      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1'/>
+    </video>
+  </devices>
+</domain>
-- 
2.10.2




More information about the Libguestfs mailing list