[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH 4/6] tests: use fake virtio-win drivers



In order to test the copying of virtio-win drivers into the guest during
v2v, create a set of fake virtio-win drivers and make use of them in the
corresponding v2v tests.

Signed-off-by: Roman Kagan <rkagan virtuozzo com>
---
 tests/fake-virtio-win/drivers/i386/Win7/netkvm.cat |  1 +
 tests/fake-virtio-win/drivers/i386/Win7/netkvm.inf |  1 +
 tests/fake-virtio-win/drivers/i386/Win7/netkvm.sys |  1 +
 tests/fake-virtio-win/drivers/i386/Win7/qxl.cat    |  1 +
 tests/fake-virtio-win/drivers/i386/Win7/qxl.inf    |  1 +
 tests/fake-virtio-win/drivers/i386/Win7/qxl.sys    |  1 +
 .../fake-virtio-win/drivers/i386/Win7/vioscsi.cat  |  1 +
 .../fake-virtio-win/drivers/i386/Win7/vioscsi.inf  |  1 +
 .../fake-virtio-win/drivers/i386/Win7/vioscsi.sys  |  1 +
 .../fake-virtio-win/drivers/i386/Win7/viostor.cat  |  1 +
 .../fake-virtio-win/drivers/i386/Win7/viostor.inf  |  1 +
 .../fake-virtio-win/drivers/i386/Win7/viostor.sys  |  1 +
 v2v/test-v2v-cdrom.sh                              |  1 +
 v2v/test-v2v-i-ova-two-disks.sh                    |  1 +
 v2v/test-v2v-i-ova.sh                              |  1 +
 v2v/test-v2v-windows-conversion.sh                 | 26 +++++++++++++---------
 16 files changed, 31 insertions(+), 10 deletions(-)
 create mode 100644 tests/fake-virtio-win/drivers/i386/Win7/netkvm.cat
 create mode 100644 tests/fake-virtio-win/drivers/i386/Win7/netkvm.inf
 create mode 100644 tests/fake-virtio-win/drivers/i386/Win7/netkvm.sys
 create mode 100644 tests/fake-virtio-win/drivers/i386/Win7/qxl.cat
 create mode 100644 tests/fake-virtio-win/drivers/i386/Win7/qxl.inf
 create mode 100644 tests/fake-virtio-win/drivers/i386/Win7/qxl.sys
 create mode 100644 tests/fake-virtio-win/drivers/i386/Win7/vioscsi.cat
 create mode 100644 tests/fake-virtio-win/drivers/i386/Win7/vioscsi.inf
 create mode 100644 tests/fake-virtio-win/drivers/i386/Win7/vioscsi.sys
 create mode 100644 tests/fake-virtio-win/drivers/i386/Win7/viostor.cat
 create mode 100644 tests/fake-virtio-win/drivers/i386/Win7/viostor.inf
 create mode 100644 tests/fake-virtio-win/drivers/i386/Win7/viostor.sys

diff --git a/tests/fake-virtio-win/drivers/i386/Win7/netkvm.cat b/tests/fake-virtio-win/drivers/i386/Win7/netkvm.cat
new file mode 100644
index 0000000..be81e94
--- /dev/null
+++ b/tests/fake-virtio-win/drivers/i386/Win7/netkvm.cat
@@ -0,0 +1 @@
+This is a fake netkvm.cat, used for testing only
diff --git a/tests/fake-virtio-win/drivers/i386/Win7/netkvm.inf b/tests/fake-virtio-win/drivers/i386/Win7/netkvm.inf
new file mode 100644
index 0000000..ab4a68f
--- /dev/null
+++ b/tests/fake-virtio-win/drivers/i386/Win7/netkvm.inf
@@ -0,0 +1 @@
+This is a fake netkvm.inf, used for testing only
diff --git a/tests/fake-virtio-win/drivers/i386/Win7/netkvm.sys b/tests/fake-virtio-win/drivers/i386/Win7/netkvm.sys
new file mode 100644
index 0000000..3a2afae
--- /dev/null
+++ b/tests/fake-virtio-win/drivers/i386/Win7/netkvm.sys
@@ -0,0 +1 @@
+This is a fake netkvm.sys, used for testing only
diff --git a/tests/fake-virtio-win/drivers/i386/Win7/qxl.cat b/tests/fake-virtio-win/drivers/i386/Win7/qxl.cat
new file mode 100644
index 0000000..0af6a9a
--- /dev/null
+++ b/tests/fake-virtio-win/drivers/i386/Win7/qxl.cat
@@ -0,0 +1 @@
+This is a fake qxl.cat, used for testing only
diff --git a/tests/fake-virtio-win/drivers/i386/Win7/qxl.inf b/tests/fake-virtio-win/drivers/i386/Win7/qxl.inf
new file mode 100644
index 0000000..3fb759d
--- /dev/null
+++ b/tests/fake-virtio-win/drivers/i386/Win7/qxl.inf
@@ -0,0 +1 @@
+This is a fake qxl.inf, used for testing only
diff --git a/tests/fake-virtio-win/drivers/i386/Win7/qxl.sys b/tests/fake-virtio-win/drivers/i386/Win7/qxl.sys
new file mode 100644
index 0000000..118ede0
--- /dev/null
+++ b/tests/fake-virtio-win/drivers/i386/Win7/qxl.sys
@@ -0,0 +1 @@
+This is a fake qxl.sys, used for testing only
diff --git a/tests/fake-virtio-win/drivers/i386/Win7/vioscsi.cat b/tests/fake-virtio-win/drivers/i386/Win7/vioscsi.cat
new file mode 100644
index 0000000..056535f
--- /dev/null
+++ b/tests/fake-virtio-win/drivers/i386/Win7/vioscsi.cat
@@ -0,0 +1 @@
+This is a fake vioscsi.cat, used for testing only
diff --git a/tests/fake-virtio-win/drivers/i386/Win7/vioscsi.inf b/tests/fake-virtio-win/drivers/i386/Win7/vioscsi.inf
new file mode 100644
index 0000000..97b3884
--- /dev/null
+++ b/tests/fake-virtio-win/drivers/i386/Win7/vioscsi.inf
@@ -0,0 +1 @@
+This is a fake vioscsi.inf, used for testing only
diff --git a/tests/fake-virtio-win/drivers/i386/Win7/vioscsi.sys b/tests/fake-virtio-win/drivers/i386/Win7/vioscsi.sys
new file mode 100644
index 0000000..102a797
--- /dev/null
+++ b/tests/fake-virtio-win/drivers/i386/Win7/vioscsi.sys
@@ -0,0 +1 @@
+This is a fake vioscsi.sys, used for testing only
diff --git a/tests/fake-virtio-win/drivers/i386/Win7/viostor.cat b/tests/fake-virtio-win/drivers/i386/Win7/viostor.cat
new file mode 100644
index 0000000..6c32f85
--- /dev/null
+++ b/tests/fake-virtio-win/drivers/i386/Win7/viostor.cat
@@ -0,0 +1 @@
+This is a fake viostor.cat, used for testing only
diff --git a/tests/fake-virtio-win/drivers/i386/Win7/viostor.inf b/tests/fake-virtio-win/drivers/i386/Win7/viostor.inf
new file mode 100644
index 0000000..18f416d
--- /dev/null
+++ b/tests/fake-virtio-win/drivers/i386/Win7/viostor.inf
@@ -0,0 +1 @@
+This is a fake viostor.inf, used for testing only
diff --git a/tests/fake-virtio-win/drivers/i386/Win7/viostor.sys b/tests/fake-virtio-win/drivers/i386/Win7/viostor.sys
new file mode 100644
index 0000000..3f9c147
--- /dev/null
+++ b/tests/fake-virtio-win/drivers/i386/Win7/viostor.sys
@@ -0,0 +1 @@
+This is a fake viostor.sys, used for testing only
diff --git a/v2v/test-v2v-cdrom.sh b/v2v/test-v2v-cdrom.sh
index 25bf275..a963c73 100755
--- a/v2v/test-v2v-cdrom.sh
+++ b/v2v/test-v2v-cdrom.sh
@@ -49,6 +49,7 @@ if ! test -f $f || ! test -s $f; then
 fi
 
 export VIRT_TOOLS_DATA_DIR="$abs_builddir/../tests/fake-virt-tools"
+export VIRTIO_WIN="$abs_builddir/../tests/fake-virtio-win"
 
 d=test-v2v-cdrom.d
 rm -rf $d
diff --git a/v2v/test-v2v-i-ova-two-disks.sh b/v2v/test-v2v-i-ova-two-disks.sh
index ede6766..e7b4137 100755
--- a/v2v/test-v2v-i-ova-two-disks.sh
+++ b/v2v/test-v2v-i-ova-two-disks.sh
@@ -34,6 +34,7 @@ fi
 
 abs_top_builddir="$(cd ..; pwd)"
 export VIRT_TOOLS_DATA_DIR="$abs_top_builddir/tests/fake-virt-tools"
+export VIRTIO_WIN="$abs_top_builddir/tests/fake-virtio-win"
 
 d=test-v2v-i-ova-two-disks.d
 rm -rf $d
diff --git a/v2v/test-v2v-i-ova.sh b/v2v/test-v2v-i-ova.sh
index 37fc89e..aaf5031 100755
--- a/v2v/test-v2v-i-ova.sh
+++ b/v2v/test-v2v-i-ova.sh
@@ -40,6 +40,7 @@ fi
 
 abs_top_builddir="$(cd ..; pwd)"
 export VIRT_TOOLS_DATA_DIR="$abs_top_builddir/tests/fake-virt-tools"
+export VIRTIO_WIN="$abs_top_builddir/tests/fake-virtio-win"
 
 d=test-v2v-i-ova.d
 rm -rf $d
diff --git a/v2v/test-v2v-windows-conversion.sh b/v2v/test-v2v-windows-conversion.sh
index 916699d..3f4ae39 100755
--- a/v2v/test-v2v-windows-conversion.sh
+++ b/v2v/test-v2v-windows-conversion.sh
@@ -42,6 +42,7 @@ if ! test -f $f || ! test -s $f; then
 fi
 
 export VIRT_TOOLS_DATA_DIR="$abs_top_builddir/tests/fake-virt-tools"
+export VIRTIO_WIN="$abs_top_builddir/tests/fake-virtio-win"
 
 # Return a random element from the array 'choices'.
 function random_choice
@@ -67,23 +68,28 @@ test -f $d/windows.xml
 test -f $d/windows-sda
 
 # Test some aspects of the target disk image.
+firstboot_dir="/Program Files/Red Hat/Firstboot"
+virtio_dir="/Windows/Drivers/VirtIO"
 {
-guestfish --ro -a $d/windows-sda -i <<EOF
-  trace 1
-  is-dir "/Program Files/Red Hat/Firstboot"
-  is-file "/Program Files/Red Hat/Firstboot/firstboot.bat"
-  is-dir "/Program Files/Red Hat/Firstboot/scripts"
-  is-dir "/Windows/Drivers/VirtIO"
-  trace 0
-EOF
-} | {
+    echo "trace 1"
+    echo "is-dir \"$firstboot_dir\""
+    echo "is-file \"$firstboot_dir/firstboot.bat\""
+    echo "is-dir \"$firstboot_dir/scripts\""
+    echo "is-dir \"$virtio_dir\""
+    for drv in netkvm qxl vioscsi viostor; do
+        for sfx in cat inf sys; do
+            echo "is-file \"$virtio_dir/$drv.$sfx\""
+        done
+    done
+    echo "trace 0"
+} | guestfish --ro -a $d/windows-sda -i | {
     ret=0
     while read r; do
         [ "$r" = "true" ] || ret=1
     done
     exit $ret
 }
-(( PIPESTATUS[0] == 0 ))
+(( PIPESTATUS[1] == 0 ))
 
 # We also update the Registry several times, for firstboot, and (ONLY
 # if the virtio-win drivers are installed locally) the critical device
-- 
2.4.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]