]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
tests: protect test libs against multiple inclusion
authorStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 26 Jul 2012 10:21:40 +0000 (12:21 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 26 Jul 2012 12:11:39 +0000 (14:11 +0200)
* 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>
Makefile.am
t/ax/am-test-lib.sh
t/ax/test-lib.sh

index ce502b4ec2e568613a0fa750cd29ef2c3d51bd90..e55e43de6540596b6f9a11f85b6834a4c33bfbed 100644 (file)
@@ -342,6 +342,8 @@ AM_TESTS_ENVIRONMENT = \
     am_test_prefer_config_shell \
     am_original_AUTOMAKE \
     am_original_ACLOCAL \
+    am_test_lib_sourced \
+    test_lib_sourced \
   ; do \
     eval test x"\$${$$v}" = x || unset $$v; \
   done;
index aaa8df5404ecbd990f5cde777a2c0a6283138a67..8a0e11726b01fe9c8f54f9b71f2d2969ffb24f9d 100644 (file)
 ###  IMPORTANT NOTE: keep this file 'set -e' clean.  ###
 ########################################################
 
+# Do not source several times.
+test ${am_test_lib_sourced-no} = yes && return 0
+am_test_lib_sourced=yes
+
 # A literal escape character.  Used by test checking colored output.
 esc='\e'
 
index 60ffd9871caf0c5fb4de5fce733afcfc1147126a..9a530b16e5065db66c4685abb8ebc4ad72fb3489 100644 (file)
 ###  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