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>
---
changes since v1:
- relocated fake-virt-tools under v2v
- referred to fake-virt-tools via $PWD in test scripts
- packaged fake-virt-tools
v2v/Makefile.am | 5 +++++
v2v/fake-virt-tools/rhsrvany.exe | 1 +
v2v/test-v2v-cdrom.sh | 6 +-----
v2v/test-v2v-i-disk.sh | 6 +-----
v2v/test-v2v-i-ova-formats.sh | 6 +-----
v2v/test-v2v-i-ova-gz.sh | 6 +-----
v2v/test-v2v-i-ova-two-disks.sh | 6 +-----
v2v/test-v2v-i-ova.sh | 6 +-----
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 +-----
21 files changed, 25 insertions(+), 95 deletions(-)
create mode 100644 v2v/fake-virt-tools/rhsrvany.exe
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
index 5f2a0ee..e3fa1b5 100644
--- a/v2v/Makefile.am
+++ b/v2v/Makefile.am
@@ -21,6 +21,7 @@ EXTRA_DIST = \
$(SOURCES_MLI) $(SOURCES_ML) $(SOURCES_C) \
v2v_unit_tests.ml \
$(TESTS) $(SLOW_TESTS) \
+ $(FAKE_VIRT_TOOLS) \
HACKING \
test-v2v-cdrom.expected \
test-v2v-cdrom.xml \
@@ -106,6 +107,10 @@ SOURCES_C = \
utils-c.c \
xml-c.c
+fake_virt_tools_dir = fake-virt-tools
+FAKE_VIRT_TOOLS = \
+ $(fake_virt_tools_dir)/rhsrvany.exe
+
if HAVE_OCAML
bin_PROGRAMS = virt-v2v
diff --git a/v2v/fake-virt-tools/rhsrvany.exe b/v2v/fake-virt-tools/rhsrvany.exe
new file mode 100644
index 0000000..b474349
--- /dev/null
+++ b/v2v/fake-virt-tools/rhsrvany.exe
@@ -0,0 +1 @@
+This is a fake rhsrvany.exe, used for testing only
diff --git a/v2v/test-v2v-cdrom.sh b/v2v/test-v2v-cdrom.sh
index 93975c2..1b03b13 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="$PWD/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..17f904c 100755
--- a/v2v/test-v2v-i-disk.sh
+++ b/v2v/test-v2v-i-disk.sh
@@ -38,11 +38,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="$PWD/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..86ae5e0 100755
--- a/v2v/test-v2v-i-ova-formats.sh
+++ b/v2v/test-v2v-i-ova-formats.sh
@@ -44,11 +44,7 @@ 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
+export VIRT_TOOLS_DATA_DIR="$PWD/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..57c2942 100755
--- a/v2v/test-v2v-i-ova-gz.sh
+++ b/v2v/test-v2v-i-ova-gz.sh
@@ -32,11 +32,7 @@ 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
+export VIRT_TOOLS_DATA_DIR="$PWD/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..ea50f16 100755
--- a/v2v/test-v2v-i-ova-two-disks.sh
+++ b/v2v/test-v2v-i-ova-two-disks.sh
@@ -32,11 +32,7 @@ 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
+export VIRT_TOOLS_DATA_DIR="$PWD/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..1ec6cce 100755
--- a/v2v/test-v2v-i-ova.sh
+++ b/v2v/test-v2v-i-ova.sh
@@ -38,11 +38,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="$PWD/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..1c16640 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="$PWD/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..647c668 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="$PWD/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..a08364b 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="$PWD/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 a21f816..ac2862a 100755
--- a/v2v/test-v2v-o-libvirt.sh
+++ b/v2v/test-v2v-o-libvirt.sh
@@ -58,11 +58,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="$PWD/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..4a95740 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="$PWD/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..d6fb69f 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="$PWD/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..897a82d 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="$PWD/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..914c70a 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="$PWD/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..4de80c0 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="$PWD/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..dea3d40 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="$PWD/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..3cca6c2 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="$PWD/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..661a898 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="$PWD/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..1688d11 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="$PWD/fake-virt-tools"
# Return a random element from the array 'choices'.
function random_choice
--
2.4.3