From: Stefano Lattarini Date: Sat, 23 Jun 2012 11:42:10 +0000 (+0200) Subject: tests: fix automatic re-execution of tests with Zsh X-Git-Tag: v1.12.2~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a7149594efc4ae7cd9f2b362baecde9d94e13f5;p=thirdparty%2Fautomake.git tests: fix automatic re-execution of tests with Zsh * defs: Use '$argv0' instead of '$0'. With Zsh not started right away in Bourne-compatibility mode, the latter will be the path not of the test script itself, but of the file it's currently sourcing -- i.e., in our case, './defs'. This would cause the automatic re-execution code to execute './defs' (basically a no-op) rather than re-run the test correctly. Signed-off-by: Stefano Lattarini --- diff --git a/defs b/defs index a47a54117..217665eaf 100644 --- a/defs +++ b/defs @@ -32,8 +32,8 @@ case ${AM_TESTS_REEXEC-yes} in ;; *) # Ensure we can find ourselves. - if test ! -f "$0"; then - echo "$0: unable to find myself" >&2 + if test ! -f "$argv0"; then + echo "$argv0: unable to find myself" >&2 exit 99 fi AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC @@ -46,10 +46,10 @@ case ${AM_TESTS_REEXEC-yes} in *x*) opts=-x;; *) opts=;; esac - echo exec $AM_TEST_RUNNER_SHELL $opts "$0" "$*" - exec $AM_TEST_RUNNER_SHELL $opts "$0" ${1+"$@"} + echo exec $AM_TEST_RUNNER_SHELL $opts "$argv0" "$*" + exec $AM_TEST_RUNNER_SHELL $opts "$argv0" ${1+"$@"} # This should be dead code, unless some strange error happened. - echo "$0: failed to re-execute with $AM_TEST_RUNNER_SHELL" >&2 + echo "$argv0: failed to re-execute with $AM_TEST_RUNNER_SHELL" >&2 exit 99 ;; esac