This macro(?) expands to some shell script to source the
tests/test-functions.sh file from its correct location. The intention
is to use this in all tests, but in this commit only the existing
tests which already include test-functions.sh are modified.
---
subdir-rules.mk | 5 +++++
tests/qemu/qemu-liveness.sh | 2 +-
tests/qemu/qemu-snapshot-isolation.sh | 2 +-
v2v/test-v2v-i-ova-formats.sh | 4 ++--
v2v/test-v2v-i-ova-gz.sh | 4 ++--
v2v/test-v2v-i-ova-subfolders.sh | 4 ++--
v2v/test-v2v-i-ova-tar.sh | 4 ++--
v2v/test-v2v-i-ova-two-disks.sh | 4 ++--
v2v/test-v2v-i-ova.sh | 4 ++--
v2v/test-v2v-in-place.sh | 4 ++--
10 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/subdir-rules.mk b/subdir-rules.mk
index c6b21fd..4926c9c 100644
--- a/subdir-rules.mk
+++ b/subdir-rules.mk
@@ -87,3 +87,8 @@ if HAVE_OCAMLOPT
.ml.cmx:
$(guestfs_am_v_ocamlopt)$(OCAMLFIND) ocamlopt $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o
$@
endif
+
+# Test shell scripts should use '$TEST_FUNCTIONS' to get a predefined
+# set of helper functions for running tests (see
+# tests/test-functions.sh).
+export TEST_FUNCTIONS := source $(abs_top_srcdir)/tests/test-functions.sh
diff --git a/tests/qemu/qemu-liveness.sh b/tests/qemu/qemu-liveness.sh
index 6f59da7..c9b79f0 100755
--- a/tests/qemu/qemu-liveness.sh
+++ b/tests/qemu/qemu-liveness.sh
@@ -22,7 +22,7 @@
set -e
-. $srcdir/../../tests/test-functions.sh
+$TEST_FUNCTIONS
rm -f liveness1.img
diff --git a/tests/qemu/qemu-snapshot-isolation.sh
b/tests/qemu/qemu-snapshot-isolation.sh
index e062328..d72ff9f 100755
--- a/tests/qemu/qemu-snapshot-isolation.sh
+++ b/tests/qemu/qemu-snapshot-isolation.sh
@@ -22,7 +22,7 @@
set -e
-. $srcdir/../../tests/test-functions.sh
+$TEST_FUNCTIONS
# UML backend doesn't support qcow2 format.
supports_qcow2=yes
diff --git a/v2v/test-v2v-i-ova-formats.sh b/v2v/test-v2v-i-ova-formats.sh
index 4c60de2..d49b7be 100755
--- a/v2v/test-v2v-i-ova-formats.sh
+++ b/v2v/test-v2v-i-ova-formats.sh
@@ -22,6 +22,8 @@ unset CDPATH
export LANG=C
set -e
+$TEST_FUNCTIONS
+
formats="zip tar-gz tar-xz"
if [ -n "$SKIP_TEST_V2V_I_OVA_FORMATS_SH" ]; then
@@ -46,8 +48,6 @@ fi
export VIRT_TOOLS_DATA_DIR="$srcdir/../test-data/fake-virt-tools"
-. $srcdir/../tests/test-functions.sh
-
d=test-v2v-i-ova-formats.d
rm -rf $d
mkdir $d
diff --git a/v2v/test-v2v-i-ova-gz.sh b/v2v/test-v2v-i-ova-gz.sh
index 33a98f3..e292683 100755
--- a/v2v/test-v2v-i-ova-gz.sh
+++ b/v2v/test-v2v-i-ova-gz.sh
@@ -22,6 +22,8 @@ unset CDPATH
export LANG=C
set -e
+$TEST_FUNCTIONS
+
if [ -n "$SKIP_TEST_V2V_I_OVA_GZ_SH" ]; then
echo "$0: test skipped because environment variable is set"
exit 77
@@ -34,8 +36,6 @@ fi
export VIRT_TOOLS_DATA_DIR="$srcdir/../test-data/fake-virt-tools"
-. $srcdir/../tests/test-functions.sh
-
d=test-v2v-i-ova-gz.d
rm -rf $d
mkdir $d
diff --git a/v2v/test-v2v-i-ova-subfolders.sh b/v2v/test-v2v-i-ova-subfolders.sh
index d1e12f9..ea3352c 100755
--- a/v2v/test-v2v-i-ova-subfolders.sh
+++ b/v2v/test-v2v-i-ova-subfolders.sh
@@ -22,6 +22,8 @@ unset CDPATH
export LANG=C
set -e
+$TEST_FUNCTIONS
+
if [ -n "$SKIP_TEST_V2V_I_OVA_SUBFOLDERS_SH" ]; then
echo "$0: test skipped because environment variable is set"
exit 77
@@ -34,8 +36,6 @@ fi
export VIRT_TOOLS_DATA_DIR="$srcdir/../test-data/fake-virt-tools"
-. $srcdir/../tests/test-functions.sh
-
d=test-v2v-i-ova-subfolders.d
rm -rf $d
mkdir -p $d/subfolder
diff --git a/v2v/test-v2v-i-ova-tar.sh b/v2v/test-v2v-i-ova-tar.sh
index dc3838b..2d1389d 100755
--- a/v2v/test-v2v-i-ova-tar.sh
+++ b/v2v/test-v2v-i-ova-tar.sh
@@ -22,6 +22,8 @@ unset CDPATH
export LANG=C
set -e
+$TEST_FUNCTIONS
+
if [ -n "$SKIP_TEST_V2V_I_OVA_FORMATS_SH" ]; then
echo "$0: test skipped because environment variable is set"
exit 77
@@ -34,8 +36,6 @@ fi
export VIRT_TOOLS_DATA_DIR="$srcdir/../test-data/fake-virt-tools"
-. $srcdir/../tests/test-functions.sh
-
d=test-v2v-i-ova-tar.d
rm -rf $d
mkdir $d
diff --git a/v2v/test-v2v-i-ova-two-disks.sh b/v2v/test-v2v-i-ova-two-disks.sh
index bbc2df0..86584c3 100755
--- a/v2v/test-v2v-i-ova-two-disks.sh
+++ b/v2v/test-v2v-i-ova-two-disks.sh
@@ -22,6 +22,8 @@ unset CDPATH
export LANG=C
set -e
+$TEST_FUNCTIONS
+
if [ -n "$SKIP_TEST_V2V_I_OVA_TWO_DISKS_SH" ]; then
echo "$0: test skipped because environment variable is set"
exit 77
@@ -35,8 +37,6 @@ fi
export VIRT_TOOLS_DATA_DIR="$srcdir/../test-data/fake-virt-tools"
export VIRTIO_WIN="$srcdir/../test-data/fake-virtio-win"
-. $srcdir/../tests/test-functions.sh
-
d=test-v2v-i-ova-two-disks.d
rm -rf $d
mkdir $d
diff --git a/v2v/test-v2v-i-ova.sh b/v2v/test-v2v-i-ova.sh
index 3f426c4..4b97a1a 100755
--- a/v2v/test-v2v-i-ova.sh
+++ b/v2v/test-v2v-i-ova.sh
@@ -22,6 +22,8 @@ unset CDPATH
export LANG=C
set -e
+$TEST_FUNCTIONS
+
if [ -n "$SKIP_TEST_V2V_I_OVA_SH" ]; then
echo "$0: test skipped because environment variable is set"
exit 77
@@ -48,8 +50,6 @@ fi
export VIRT_TOOLS_DATA_DIR="$srcdir/../test-data/fake-virt-tools"
export VIRTIO_WIN="$srcdir/../test-data/fake-virtio-win"
-. $srcdir/../tests/test-functions.sh
-
d=test-v2v-i-ova.d
rm -rf $d
mkdir $d
diff --git a/v2v/test-v2v-in-place.sh b/v2v/test-v2v-in-place.sh
index c49b9b5..c8b2ec4 100755
--- a/v2v/test-v2v-in-place.sh
+++ b/v2v/test-v2v-in-place.sh
@@ -23,6 +23,8 @@ unset CDPATH
export LANG=C
set -e
+$TEST_FUNCTIONS
+
if [ -n "$SKIP_TEST_V2V_IN_PLACE_SH" ]; then
echo "$0: test skipped because environment variable is set"
exit 77
@@ -44,8 +46,6 @@ fi
export VIRT_TOOLS_DATA_DIR="$srcdir/../test-data/fake-virt-tools"
export VIRTIO_WIN="$srcdir/../test-data/fake-virtio-win"
-. $srcdir/../tests/test-functions.sh
-
d=$PWD/test-v2v-in-place.d
rm -rf $d
mkdir $d
--
2.9.3