1 #!@AM_TEST_RUNNER_SHELL@
3 # Copyright (C) 2012 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # Run an Automake test from the command line.
22 : ${AM_TEST_RUNNER_SHELL='@AM_TEST_RUNNER_SHELL@'}
23 : ${AM_PROVE_CMD='prove'}
24 : ${AM_PROVEFLAGS='--merge --verbose'}
25 : ${srcdir='@srcdir@'}
26 : ${abs_srcdir='@abs_srcdir@'}
27 : ${abs_builddir='@abs_builddir@'}
28 : ${PATH_SEPARATOR='@PATH_SEPARATOR@'}
30 # For sourcing of extra "shell libraries" by our test scripts. As per
31 # POSIX, sourcing a file with '.' will cause it to be looked up in $PATH
32 # in case it is given with a relative name containing no slashes.
33 if test "$srcdir" != .; then
34 PATH=$abs_srcdir/t/ax$PATH_SEPARATOR$PATH
36 PATH=$abs_builddir/t/ax$PATH_SEPARATOR$PATH
39 # For use by the testsuite framework. The Automake test harness
40 # define this, so we better do the same.
43 # Some testsuite-influential variables should be overridable from the
44 # test scripts, but not from the environment.
45 # Keep this in sync with the 'Makefile.am:AM_TESTS_ENVIRONMENT'.
50 am_test_prefer_config_shell \
51 am_original_AUTOMAKE \
56 eval "$v= && unset $v" || exit 1
60 error () { echo "$0: $*" >&2; exit 255; }
62 # Some shell flags should be passed over to the test scripts.
64 while test $# -gt 0; do
67 echo "Usage: $0 [--shell=PATH] [SHELL-OPTIONS] TEST [TEST-OPTIONS]"
71 test $# -gt 1 || error "missing argument for option '$1'"
72 AM_TEST_RUNNER_SHELL=$2
76 AM_TEST_RUNNER_SHELL=${1#--shell=}
79 test $# -gt 1 || error "missing argument for option '$1'"
80 shell_opts="$shell_opts -o $2"
84 # Assume it is an option to pass through to the shell.
85 shell_opts="$shell_opts $1";;
92 test $# -gt 0 || error "missing argument"
98 *) if test -f ./$tst; then
100 # Support for VPATH build.
101 elif test -f $srcdir/$tst; then
104 error "could not find test '$tst'"
111 exec $AM_TEST_RUNNER_SHELL $shell_opts "$tst" ${1+"$@"} ;;
113 exec "$AM_PROVE_CMD" $AM_PROVEFLAGS -e \
114 "$AM_TEST_RUNNER_SHELL $shell_opts" "$tst" ${1+"$@"} ;;
116 error "test '$tst' has an unrecognized extension" ;;
119 error "dead code reached"