summaryrefslogtreecommitdiff
path: root/t/ax/test-lib.sh
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2012-07-26 12:21:40 +0200
committerStefano Lattarini <stefano.lattarini@gmail.com>2012-07-26 14:11:39 +0200
commitd8b3c5e4b81986b875f56502006288f43aee5159 (patch)
tree22f8be673deba523de807e249ab64894eb78ffc0 /t/ax/test-lib.sh
parent60f8b3de17ae8812c8e1fc6dd2eb8fe492aee9c7 (diff)
downloadautomake-d8b3c5e4b81986b875f56502006288f43aee5159.tar.gz
tests: protect test libs against multiple inclusion
* t/ax/test-lib.sh, t/ax/am-test-lib.sh: Return early if already sourced. Use the witness variables '$test_lib_sourced' and '$am_test_lib_sourced', respectively, for this purpose. * runtest.in, Makefile.am (AM_TESTS_ENVIRONMENT): Unset 'test_lib_sourced' and 'am_test_lib_sourced', to avoid interferences from the environment. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Diffstat (limited to 't/ax/test-lib.sh')
-rw-r--r--t/ax/test-lib.sh4
1 files changed, 4 insertions, 0 deletions
diff --git a/t/ax/test-lib.sh b/t/ax/test-lib.sh
index 60ffd9871..9a530b16e 100644
--- a/t/ax/test-lib.sh
+++ b/t/ax/test-lib.sh
@@ -19,6 +19,10 @@
### IMPORTANT NOTE: keep this file 'set -e' clean. ###
########################################################
+# Do not source several times.
+test ${test_lib_sourced-no} = yes && return 0
+test_lib_sourced=yes
+
# CDPATH is evil if used in non-interactive scripts (and even more
# evil if exported in the environment).
CDPATH=; unset CDPATH