;;
*)
# 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
*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
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
- # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
- # If Zsh is not started directly in Bourne-compatibility mode, it has
- # some incompatibilities in the handling of $0 that conflict with
- # our usage: i.e., $0 inside a file sourced with the '.' builtin is
- # temporarily set to the name of the sourced file.
- # Work around this when possible, otherwise abort the script.
+ # If Zsh is not started directly in POSIX-compatibility mode, it has some
+ # incompatibilities in the handling of $0 that conflict with our usage;
+ # i.e., $0 inside a file sourced with the '.' builtin is temporarily set
+ # to the name of the sourced file. Work around that.
# Note that a bug in some versions of Zsh prevents us from resetting $0
# in a sourced script, so the use of $argv0. For more info see:
- # <http://www.zsh.org/mla/workers/2009/msg01140.html>
- # Note: the apparently useless 'eval' below are needed by at least
- # dash 0.5.2, to prevent it from bailing out with an error like
- # "Syntax error: Bad substitution"
- if eval '[[ "$0" = *."test" ]]'; then
- # Good, FUNCTION_ARGZERO option was already off when this file was
- # sourced. Thus we've nothing to do.
- argv0=$0
- elif eval 'test -n "${functrace[-1]}"'; then
- # FUNCTION_ARGZERO option was on, but we have a easy workaround.
- eval 'argv0=${functrace[-1]%:*}'
- else
- # Give up.
- echo "$0: cannot determine the path of running test script" >&2
- echo "$0: test was running with Zsh version $ZSH_VERSION" >&2
- echo "$0: did you enable the NO_FUNCTION_ARGZERO option?" >&2
+ # <http://www.zsh.org/mla/workers/2009/msg01140.html>
+ # The apparently useless 'eval' here is needed by at least dash 0.5.2,
+ # to prevent it from bailing out with an error like:
+ # "Syntax error: Bad substitution".
+ eval 'argv0=${functrace[-1]%:*}' && test -f "$argv0" || {
+ echo "Cannot determine the path of running test script." >&2
+ echo "Your Zsh (version $ZSH_VERSION) is probably too old." >&2
exit 99
- fi
+ }
else
argv0=$0
# Avoid command substitution failure, for Tru64 sh -e and instspc*.test.
# The shell we use to run our own test scripts, determined at configure
# time. It is required in the self tests, and most importantly for the
-# the automatic re-execution of test scripts.
-AM_TEST_RUNNER_SHELL='@AM_TEST_RUNNER_SHELL@'
+# automatic re-execution of test scripts.
+AM_TEST_RUNNER_SHELL=${AM_TEST_RUNNER_SHELL-'@AM_TEST_RUNNER_SHELL@'}
# Make sure we override the user shell. And do not read the value of
# $SHELL from the environment (think to the non-uncommon situation where
to run the test(s) through the makefile test driver.
The test scripts are written with portability in mind, so that they
- should run with any decent Bourne-compatible shell.
-
- However, some care must be used with Zsh, since, when not directly
- started in Bourne-compatibility mode, it has some incompatibilities
- in the handling of $0 which conflict with our usage. Our testsuite
- can automatically work around these incompatibilities when a version
- 4.3 or later of Zsh is used, but unfortunately not when an older
- version of Zsh is used. Thus, if you want to run a test script, say
- 'foo.sh', with Zsh 4.2, you *can't* simply do "zsh foo.sh", but
- you *must* resort to:
-
- AM_TESTS_REEXEC=no zsh -o no_function_argzero foo.sh
-
- Note that this problem does not occur if Zsh is executed through
- a symlink with a basename of 'sh', since in that case Zsh starts
- in Bourne compatibility mode. So you should be perfectly safe
- when /bin/sh is Zsh, even a it's version < 4.3.
+ should run with any decent Bourne-compatible shell. However, it is
+ worth nothing that older versions of Zsh (pre-4.3) exhibited several
+ bugs and incompatibilities with our uses, and are thus not supported
+ for running Automake's test scripts.
Reporting failures