The tests that depend on rhsrvany.exe being available, actually don't
need it to be the real one: all they want is the file being present.
So, instead of skipping the tests if the real rhsrvany.exe is not found,
store a fake one in the repository, and point $VIRT_TOOLS_DATA_DIR at
its location.
Signed-off-by: Roman Kagan <rkagan(a)virtuozzo.com>
---
p2v/test-virt-p2v-pxe.sh | 10 +++-------
p2v/test-virt-p2v.sh | 9 +++------
tests/fake-virt-tools/rhsrvany.exe | 1 +
tests/regressions/rhbz1232192.sh | 7 ++-----
v2v/test-v2v-cdrom.sh | 6 +-----
v2v/test-v2v-i-disk.sh | 7 ++-----
v2v/test-v2v-i-ova-formats.sh | 7 ++-----
v2v/test-v2v-i-ova-gz.sh | 7 ++-----
v2v/test-v2v-i-ova-two-disks.sh | 7 ++-----
v2v/test-v2v-i-ova.sh | 7 ++-----
v2v/test-v2v-networks-and-bridges.sh | 6 +-----
v2v/test-v2v-no-copy.sh | 6 +-----
v2v/test-v2v-o-glance.sh | 6 +-----
v2v/test-v2v-o-libvirt.sh | 6 +-----
v2v/test-v2v-o-null.sh | 6 +-----
v2v/test-v2v-o-qemu.sh | 6 +-----
v2v/test-v2v-o-rhev.sh | 6 +-----
v2v/test-v2v-o-vdsm-options.sh | 6 +-----
v2v/test-v2v-oa-option.sh | 6 +-----
v2v/test-v2v-of-option.sh | 6 +-----
v2v/test-v2v-on-option.sh | 6 +-----
v2v/test-v2v-sound.sh | 6 +-----
v2v/test-v2v-windows-conversion.sh | 6 +-----
23 files changed, 33 insertions(+), 113 deletions(-)
create mode 100644 tests/fake-virt-tools/rhsrvany.exe
diff --git a/p2v/test-virt-p2v-pxe.sh b/p2v/test-virt-p2v-pxe.sh
index f05cb96..4a42d10 100755
--- a/p2v/test-virt-p2v-pxe.sh
+++ b/p2v/test-virt-p2v-pxe.sh
@@ -55,18 +55,14 @@ if ! test -f $img; then
exit 77
fi
-guestsdir="$(cd ../tests/guests && pwd)"
-f="$guestsdir/windows.img"
+abs_top_builddir="$(cd ..; pwd)"
+f="$abs_top_builddir/tests/guests/windows.img"
if ! test -f $f; then
echo "$0: test skipped because phony Windows image was not created"
exit 77
fi
-virt_tools_data_dir=${VIRT_TOOLS_DATA_DIR:-/usr/share/virt-tools}
-if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
- echo "$0: test skipped because rhsrvany.exe is not installed"
- exit 77
-fi
+export VIRT_TOOLS_DATA_DIR="$abs_top_builddir/tests/fake-virt-tools"
d=test-virt-p2v-pxe.d
rm -rf $d
diff --git a/p2v/test-virt-p2v.sh b/p2v/test-virt-p2v.sh
index 8c3731c..af03ba8 100755
--- a/p2v/test-virt-p2v.sh
+++ b/p2v/test-virt-p2v.sh
@@ -32,7 +32,8 @@ if [ "$(guestfish get-backend)" = "uml" ]; then
exit 77
fi
-guestsdir="$(cd ../tests/guests && pwd)"
+abs_top_builddir="$(cd ..; pwd)"
+guestsdir="$abs_top_builddir/tests/guests"
f1="$guestsdir/windows.img"
if ! test -f $f1 || ! test -s $f1; then
echo "$0: test skipped because phony Windows image was not created"
@@ -44,11 +45,7 @@ if ! test -f $f2 || ! test -s $f2; then
exit 77
fi
-virt_tools_data_dir=${VIRT_TOOLS_DATA_DIR:-/usr/share/virt-tools}
-if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
- echo "$0: test skipped because rhsrvany.exe is not installed"
- exit 77
-fi
+export VIRT_TOOLS_DATA_DIR="$abs_top_builddir/tests/fake-virt-tools"
d=test-virt-p2v.d
rm -rf $d
diff --git a/tests/fake-virt-tools/rhsrvany.exe b/tests/fake-virt-tools/rhsrvany.exe
new file mode 100644
index 0000000..b474349
--- /dev/null
+++ b/tests/fake-virt-tools/rhsrvany.exe
@@ -0,0 +1 @@
+This is a fake rhsrvany.exe, used for testing only
diff --git a/tests/regressions/rhbz1232192.sh b/tests/regressions/rhbz1232192.sh
index 5b4b31e..c0e4519 100755
--- a/tests/regressions/rhbz1232192.sh
+++ b/tests/regressions/rhbz1232192.sh
@@ -47,10 +47,7 @@ if [ ! -f ../guests/blank-disk.img ]; then
exit 77
fi
-virt_tools_data_dir=${VIRT_TOOLS_DATA_DIR:-/usr/share/virt-tools}
-if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
- echo "$0: test skipped because rhsrvany.exe is not installed"
- exit 77
-fi
+abs_top_builddir="$(cd ../..; pwd)"
+export VIRT_TOOLS_DATA_DIR="$abs_top_builddir/tests/fake-virt-tools"
../../v2v/virt-v2v -i libvirtxml rhbz1232192.xml -o null --no-copy
diff --git a/v2v/test-v2v-cdrom.sh b/v2v/test-v2v-cdrom.sh
index 93975c2..25bf275 100755
--- a/v2v/test-v2v-cdrom.sh
+++ b/v2v/test-v2v-cdrom.sh
@@ -48,11 +48,7 @@ if ! test -f $f || ! test -s $f; then
exit 77
fi
-virt_tools_data_dir=${VIRT_TOOLS_DATA_DIR:-/usr/share/virt-tools}
-if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
- echo "$0: test skipped because rhsrvany.exe is not installed"
- exit 77
-fi
+export VIRT_TOOLS_DATA_DIR="$abs_builddir/../tests/fake-virt-tools"
d=test-v2v-cdrom.d
rm -rf $d
diff --git a/v2v/test-v2v-i-disk.sh b/v2v/test-v2v-i-disk.sh
index b15e0d0..112f841 100755
--- a/v2v/test-v2v-i-disk.sh
+++ b/v2v/test-v2v-i-disk.sh
@@ -38,11 +38,8 @@ if ! test -f $f || ! test -s $f; then
exit 77
fi
-virt_tools_data_dir=${VIRT_TOOLS_DATA_DIR:-/usr/share/virt-tools}
-if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
- echo "$0: test skipped because rhsrvany.exe is not installed"
- exit 77
-fi
+abs_top_builddir="$(cd ..; pwd)"
+export VIRT_TOOLS_DATA_DIR="$abs_top_builddir/tests/fake-virt-tools"
d=test-v2v-i-disk.d
rm -rf $d
diff --git a/v2v/test-v2v-i-ova-formats.sh b/v2v/test-v2v-i-ova-formats.sh
index bd3e048..c1f60a7 100755
--- a/v2v/test-v2v-i-ova-formats.sh
+++ b/v2v/test-v2v-i-ova-formats.sh
@@ -44,11 +44,8 @@ if [ "$(guestfish get-backend)" = "uml" ]; then
exit 77
fi
-virt_tools_data_dir=${VIRT_TOOLS_DATA_DIR:-/usr/share/virt-tools}
-if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
- echo "$0: test skipped because rhsrvany.exe is not installed"
- exit 77
-fi
+abs_top_builddir="$(cd ..; pwd)"
+export VIRT_TOOLS_DATA_DIR="$abs_top_builddir/tests/fake-virt-tools"
d=test-v2v-i-ova-formats.d
rm -rf $d
diff --git a/v2v/test-v2v-i-ova-gz.sh b/v2v/test-v2v-i-ova-gz.sh
index 6c630fb..f8624af 100755
--- a/v2v/test-v2v-i-ova-gz.sh
+++ b/v2v/test-v2v-i-ova-gz.sh
@@ -32,11 +32,8 @@ if [ "$(guestfish get-backend)" = "uml" ]; then
exit 77
fi
-virt_tools_data_dir=${VIRT_TOOLS_DATA_DIR:-/usr/share/virt-tools}
-if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
- echo "$0: test skipped because rhsrvany.exe is not installed"
- exit 77
-fi
+abs_top_builddir="$(cd ..; pwd)"
+export VIRT_TOOLS_DATA_DIR="$abs_top_builddir/tests/fake-virt-tools"
d=test-v2v-i-ova-gz.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 dfda956..ede6766 100755
--- a/v2v/test-v2v-i-ova-two-disks.sh
+++ b/v2v/test-v2v-i-ova-two-disks.sh
@@ -32,11 +32,8 @@ if [ "$(guestfish get-backend)" = "uml" ]; then
exit 77
fi
-virt_tools_data_dir=${VIRT_TOOLS_DATA_DIR:-/usr/share/virt-tools}
-if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
- echo "$0: test skipped because rhsrvany.exe is not installed"
- exit 77
-fi
+abs_top_builddir="$(cd ..; pwd)"
+export VIRT_TOOLS_DATA_DIR="$abs_top_builddir/tests/fake-virt-tools"
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 5047eca..37fc89e 100755
--- a/v2v/test-v2v-i-ova.sh
+++ b/v2v/test-v2v-i-ova.sh
@@ -38,11 +38,8 @@ if ! test -f $f || ! test -s $f; then
exit 77
fi
-virt_tools_data_dir=${VIRT_TOOLS_DATA_DIR:-/usr/share/virt-tools}
-if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
- echo "$0: test skipped because rhsrvany.exe is not installed"
- exit 77
-fi
+abs_top_builddir="$(cd ..; pwd)"
+export VIRT_TOOLS_DATA_DIR="$abs_top_builddir/tests/fake-virt-tools"
d=test-v2v-i-ova.d
rm -rf $d
diff --git a/v2v/test-v2v-networks-and-bridges.sh b/v2v/test-v2v-networks-and-bridges.sh
index 68743d6..3654458 100755
--- a/v2v/test-v2v-networks-and-bridges.sh
+++ b/v2v/test-v2v-networks-and-bridges.sh
@@ -41,11 +41,7 @@ if ! test -f $f || ! test -s $f; then
exit 77
fi
-virt_tools_data_dir=${VIRT_TOOLS_DATA_DIR:-/usr/share/virt-tools}
-if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
- echo "$0: test skipped because rhsrvany.exe is not installed"
- exit 77
-fi
+export VIRT_TOOLS_DATA_DIR="$abs_builddir/../tests/fake-virt-tools"
d=test-v2v-networks-and-bridges.d
rm -rf $d
diff --git a/v2v/test-v2v-no-copy.sh b/v2v/test-v2v-no-copy.sh
index f0408dc..4eb9eb6 100755
--- a/v2v/test-v2v-no-copy.sh
+++ b/v2v/test-v2v-no-copy.sh
@@ -41,11 +41,7 @@ if ! test -f $f || ! test -s $f; then
exit 77
fi
-virt_tools_data_dir=${VIRT_TOOLS_DATA_DIR:-/usr/share/virt-tools}
-if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
- echo "$0: test skipped because rhsrvany.exe is not installed"
- exit 77
-fi
+export VIRT_TOOLS_DATA_DIR="$abs_top_builddir/tests/fake-virt-tools"
d=test-v2v-no-copy.d
rm -rf $d
diff --git a/v2v/test-v2v-o-glance.sh b/v2v/test-v2v-o-glance.sh
index 121177f..cc888d4 100755
--- a/v2v/test-v2v-o-glance.sh
+++ b/v2v/test-v2v-o-glance.sh
@@ -41,11 +41,7 @@ if ! test -f $f || ! test -s $f; then
exit 77
fi
-virt_tools_data_dir=${VIRT_TOOLS_DATA_DIR:-/usr/share/virt-tools}
-if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
- echo "$0: test skipped because rhsrvany.exe is not installed"
- exit 77
-fi
+export VIRT_TOOLS_DATA_DIR="$abs_top_builddir/tests/fake-virt-tools"
# We don't want to upload to the real glance, so introduce a fake
# glance binary.
diff --git a/v2v/test-v2v-o-libvirt.sh b/v2v/test-v2v-o-libvirt.sh
index 77b38e0..0cf59b2 100755
--- a/v2v/test-v2v-o-libvirt.sh
+++ b/v2v/test-v2v-o-libvirt.sh
@@ -49,11 +49,7 @@ if ! test -f $f || ! test -s $f; then
exit 77
fi
-virt_tools_data_dir=${VIRT_TOOLS_DATA_DIR:-/usr/share/virt-tools}
-if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
- echo "$0: test skipped because rhsrvany.exe is not installed"
- exit 77
-fi
+export VIRT_TOOLS_DATA_DIR="$abs_top_builddir/tests/fake-virt-tools"
# Generate a random guest name.
guestname=tmp-$(tr -cd 'a-f0-9' < /dev/urandom | head -c 8)
diff --git a/v2v/test-v2v-o-null.sh b/v2v/test-v2v-o-null.sh
index 9ed581b..cc32edb 100755
--- a/v2v/test-v2v-o-null.sh
+++ b/v2v/test-v2v-o-null.sh
@@ -41,11 +41,7 @@ if ! test -f $f || ! test -s $f; then
exit 77
fi
-virt_tools_data_dir=${VIRT_TOOLS_DATA_DIR:-/usr/share/virt-tools}
-if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
- echo "$0: test skipped because rhsrvany.exe is not installed"
- exit 77
-fi
+export VIRT_TOOLS_DATA_DIR="$abs_top_builddir/tests/fake-virt-tools"
$VG virt-v2v --debug-gc \
-i libvirt -ic "$libvirt_uri" windows \
diff --git a/v2v/test-v2v-o-qemu.sh b/v2v/test-v2v-o-qemu.sh
index 9de2b56..926b9b8 100755
--- a/v2v/test-v2v-o-qemu.sh
+++ b/v2v/test-v2v-o-qemu.sh
@@ -41,11 +41,7 @@ if ! test -f $f || ! test -s $f; then
exit 77
fi
-virt_tools_data_dir=${VIRT_TOOLS_DATA_DIR:-/usr/share/virt-tools}
-if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
- echo "$0: test skipped because rhsrvany.exe is not installed"
- exit 77
-fi
+export VIRT_TOOLS_DATA_DIR="$abs_top_builddir/tests/fake-virt-tools"
d=test-v2v-o-qemu.d
rm -rf $d
diff --git a/v2v/test-v2v-o-rhev.sh b/v2v/test-v2v-o-rhev.sh
index 1162e31..8d5789c 100755
--- a/v2v/test-v2v-o-rhev.sh
+++ b/v2v/test-v2v-o-rhev.sh
@@ -41,11 +41,7 @@ if ! test -f $f || ! test -s $f; then
exit 77
fi
-virt_tools_data_dir=${VIRT_TOOLS_DATA_DIR:-/usr/share/virt-tools}
-if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
- echo "$0: test skipped because rhsrvany.exe is not installed"
- exit 77
-fi
+export VIRT_TOOLS_DATA_DIR="$abs_top_builddir/tests/fake-virt-tools"
d=test-v2v-o-rhev.d
rm -rf $d
diff --git a/v2v/test-v2v-o-vdsm-options.sh b/v2v/test-v2v-o-vdsm-options.sh
index c170467..1540bd8 100755
--- a/v2v/test-v2v-o-vdsm-options.sh
+++ b/v2v/test-v2v-o-vdsm-options.sh
@@ -41,11 +41,7 @@ if ! test -f $f || ! test -s $f; then
exit 77
fi
-virt_tools_data_dir=${VIRT_TOOLS_DATA_DIR:-/usr/share/virt-tools}
-if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
- echo "$0: test skipped because rhsrvany.exe is not installed"
- exit 77
-fi
+export VIRT_TOOLS_DATA_DIR="$abs_top_builddir/tests/fake-virt-tools"
d=test-v2v-o-vdsm-options.d
rm -rf $d
diff --git a/v2v/test-v2v-oa-option.sh b/v2v/test-v2v-oa-option.sh
index c1a555a..bafdb61 100755
--- a/v2v/test-v2v-oa-option.sh
+++ b/v2v/test-v2v-oa-option.sh
@@ -41,11 +41,7 @@ if ! test -f $f || ! test -s $f; then
exit 77
fi
-virt_tools_data_dir=${VIRT_TOOLS_DATA_DIR:-/usr/share/virt-tools}
-if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
- echo "$0: test skipped because rhsrvany.exe is not installed"
- exit 77
-fi
+export VIRT_TOOLS_DATA_DIR="$abs_top_builddir/tests/fake-virt-tools"
d=test-v2v-windows-conversion.d
rm -rf $d
diff --git a/v2v/test-v2v-of-option.sh b/v2v/test-v2v-of-option.sh
index 27441cf..e118b04 100755
--- a/v2v/test-v2v-of-option.sh
+++ b/v2v/test-v2v-of-option.sh
@@ -41,11 +41,7 @@ if ! test -f $f || ! test -s $f; then
exit 77
fi
-virt_tools_data_dir=${VIRT_TOOLS_DATA_DIR:-/usr/share/virt-tools}
-if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
- echo "$0: test skipped because rhsrvany.exe is not installed"
- exit 77
-fi
+export VIRT_TOOLS_DATA_DIR="$abs_top_builddir/tests/fake-virt-tools"
d=test-v2v-windows-conversion.d
rm -rf $d
diff --git a/v2v/test-v2v-on-option.sh b/v2v/test-v2v-on-option.sh
index e3edb67..1b38ec7 100755
--- a/v2v/test-v2v-on-option.sh
+++ b/v2v/test-v2v-on-option.sh
@@ -41,11 +41,7 @@ if ! test -f $f || ! test -s $f; then
exit 77
fi
-virt_tools_data_dir=${VIRT_TOOLS_DATA_DIR:-/usr/share/virt-tools}
-if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
- echo "$0: test skipped because rhsrvany.exe is not installed"
- exit 77
-fi
+export VIRT_TOOLS_DATA_DIR="$abs_top_builddir/tests/fake-virt-tools"
d=test-v2v-windows-conversion.d
rm -rf $d
diff --git a/v2v/test-v2v-sound.sh b/v2v/test-v2v-sound.sh
index 7cb6f24..b4c13e0 100755
--- a/v2v/test-v2v-sound.sh
+++ b/v2v/test-v2v-sound.sh
@@ -41,11 +41,7 @@ if ! test -f $f || ! test -s $f; then
exit 77
fi
-virt_tools_data_dir=${VIRT_TOOLS_DATA_DIR:-/usr/share/virt-tools}
-if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
- echo "$0: test skipped because rhsrvany.exe is not installed"
- exit 77
-fi
+export VIRT_TOOLS_DATA_DIR="$abs_builddir/../tests/fake-virt-tools"
d=test-v2v-sound.d
rm -rf $d
diff --git a/v2v/test-v2v-windows-conversion.sh b/v2v/test-v2v-windows-conversion.sh
index 7e8e628..eef6f57 100755
--- a/v2v/test-v2v-windows-conversion.sh
+++ b/v2v/test-v2v-windows-conversion.sh
@@ -41,11 +41,7 @@ if ! test -f $f || ! test -s $f; then
exit 77
fi
-virt_tools_data_dir=${VIRT_TOOLS_DATA_DIR:-/usr/share/virt-tools}
-if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
- echo "$0: test skipped because rhsrvany.exe is not installed"
- exit 77
-fi
+export VIRT_TOOLS_DATA_DIR="$abs_top_builddir/tests/fake-virt-tools"
# Return a random element from the array 'choices'.
function random_choice
--
2.4.3