Skip to content

Commit

Permalink
v2v:tests: use fake virtio-win drivers
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
rvka authored and rwmjones committed Oct 8, 2015
1 parent 7bbf5ca commit 3c26dbf
Show file tree
Hide file tree
Showing 17 changed files with 31 additions and 4 deletions.
4 changes: 4 additions & 0 deletions v2v/Makefile.am
Expand Up @@ -22,6 +22,7 @@ EXTRA_DIST = \
v2v_unit_tests.ml \
$(TESTS) $(SLOW_TESTS) \
$(FAKE_VIRT_TOOLS) \
$(FAKE_VIRTIO_WIN) \
HACKING \
test-v2v-cdrom.expected \
test-v2v-cdrom.xml \
Expand Down Expand Up @@ -112,6 +113,9 @@ FAKE_VIRT_TOOLS = \
$(fake_virt_tools_dir)/rhsrvany.exe \
$(fake_virt_tools_dir)/rhev-apt.exe

fake_virtio_win_dir = fake-virtio-win
FAKE_VIRTIO_WIN = $(wildcard $(fake_virtio_win_dir)/*/*/*/*)

if HAVE_OCAML

bin_PROGRAMS = virt-v2v
Expand Down
1 change: 1 addition & 0 deletions v2v/fake-virtio-win/drivers/i386/Win7/netkvm.cat
@@ -0,0 +1 @@
This is a fake netkvm.cat, used for testing only
1 change: 1 addition & 0 deletions v2v/fake-virtio-win/drivers/i386/Win7/netkvm.inf
@@ -0,0 +1 @@
This is a fake netkvm.inf, used for testing only
1 change: 1 addition & 0 deletions v2v/fake-virtio-win/drivers/i386/Win7/netkvm.sys
@@ -0,0 +1 @@
This is a fake netkvm.sys, used for testing only
1 change: 1 addition & 0 deletions v2v/fake-virtio-win/drivers/i386/Win7/qxl.cat
@@ -0,0 +1 @@
This is a fake qxl.cat, used for testing only
1 change: 1 addition & 0 deletions v2v/fake-virtio-win/drivers/i386/Win7/qxl.inf
@@ -0,0 +1 @@
This is a fake qxl.inf, used for testing only
1 change: 1 addition & 0 deletions v2v/fake-virtio-win/drivers/i386/Win7/qxl.sys
@@ -0,0 +1 @@
This is a fake qxl.sys, used for testing only
1 change: 1 addition & 0 deletions v2v/fake-virtio-win/drivers/i386/Win7/vioscsi.cat
@@ -0,0 +1 @@
This is a fake vioscsi.cat, used for testing only
1 change: 1 addition & 0 deletions v2v/fake-virtio-win/drivers/i386/Win7/vioscsi.inf
@@ -0,0 +1 @@
This is a fake vioscsi.inf, used for testing only
1 change: 1 addition & 0 deletions v2v/fake-virtio-win/drivers/i386/Win7/vioscsi.sys
@@ -0,0 +1 @@
This is a fake vioscsi.sys, used for testing only
1 change: 1 addition & 0 deletions v2v/fake-virtio-win/drivers/i386/Win7/viostor.cat
@@ -0,0 +1 @@
This is a fake viostor.cat, used for testing only
1 change: 1 addition & 0 deletions v2v/fake-virtio-win/drivers/i386/Win7/viostor.inf
@@ -0,0 +1 @@
This is a fake viostor.inf, used for testing only
1 change: 1 addition & 0 deletions v2v/fake-virtio-win/drivers/i386/Win7/viostor.sys
@@ -0,0 +1 @@
This is a fake viostor.sys, used for testing only
1 change: 1 addition & 0 deletions v2v/test-v2v-cdrom.sh
Expand Up @@ -49,6 +49,7 @@ if ! test -f $f || ! test -s $f; then
fi

export VIRT_TOOLS_DATA_DIR="$PWD/fake-virt-tools"
export VIRTIO_WIN="$PWD/fake-virtio-win"

d=test-v2v-cdrom.d
rm -rf $d
Expand Down
1 change: 1 addition & 0 deletions v2v/test-v2v-i-ova-two-disks.sh
Expand Up @@ -33,6 +33,7 @@ if [ "$(guestfish get-backend)" = "uml" ]; then
fi

export VIRT_TOOLS_DATA_DIR="$PWD/fake-virt-tools"
export VIRTIO_WIN="$PWD/fake-virtio-win"

d=test-v2v-i-ova-two-disks.d
rm -rf $d
Expand Down
1 change: 1 addition & 0 deletions v2v/test-v2v-i-ova.sh
Expand Up @@ -39,6 +39,7 @@ if ! test -f $f || ! test -s $f; then
fi

export VIRT_TOOLS_DATA_DIR="$PWD/fake-virt-tools"
export VIRTIO_WIN="$PWD/fake-virtio-win"

d=test-v2v-i-ova.d
rm -rf $d
Expand Down
16 changes: 12 additions & 4 deletions v2v/test-v2v-windows-conversion.sh
Expand Up @@ -42,6 +42,7 @@ if ! test -f $f || ! test -s $f; then
fi

export VIRT_TOOLS_DATA_DIR="$PWD/fake-virt-tools"
export VIRTIO_WIN="$PWD/fake-virtio-win"

# Return a random element from the array 'choices'.
function random_choice
Expand Down Expand Up @@ -85,10 +86,17 @@ mktest ()
:> "$script"
:> "$expected"

mktest "is-dir \"/Program Files/Red Hat/Firstboot\"" true
mktest "is-file \"/Program Files/Red Hat/Firstboot/firstboot.bat\"" true
mktest "is-dir \"/Program Files/Red Hat/Firstboot/scripts\"" true
mktest "is-dir \"/Windows/Drivers/VirtIO\"" true
firstboot_dir="/Program Files/Red Hat/Firstboot"
mktest "is-dir \"$firstboot_dir\"" true
mktest "is-file \"$firstboot_dir/firstboot.bat\"" true
mktest "is-dir \"$firstboot_dir/scripts\"" true
virtio_dir="/Windows/Drivers/VirtIO"
mktest "is-dir \"$virtio_dir\"" true
for drv in netkvm qxl vioscsi viostor; do
for sfx in cat inf sys; do
mktest "is-file \"$virtio_dir/$drv.$sfx\"" true
done
done

guestfish --ro -a "$d/windows-sda" -i < "$script" > "$response"
diff -u "$expected" "$response"
Expand Down

0 comments on commit 3c26dbf

Please sign in to comment.