[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/4] tests: shell running test scripts is now named AM_TEST_RUNNE
From: |
Stefano Lattarini |
Subject: |
[PATCH 1/4] tests: shell running test scripts is now named AM_TEST_RUNNER_SHELL |
Date: |
Mon, 17 Oct 2011 13:43:59 +0200 |
This is just a preparatory refactoring for future changes.
* configure.ac (AM_TEST_RUNNER_SHELL): New variable, defined to
`$SHELL', and AC_SUBST'd.
* tests/Makefile.am (LOG_COMPILER): Redefine from $(SHELL) to
$(AM_TEST_RUNNER_SHELL).
(do_subst): Also substitute address@hidden@'.
* tests/defs: Adjust to use $AM_TEST_RUNNER_SHELL instead
of $CONFIG_SHELL and/or $SHELL, where appropriate. Minor
opportunistic changes.
* tests/self-check-explicit-skips.test: Likewise.
* tests/self-check-sanity.test: Likewise.
* tests/self-check-tap.test: Likewise.
* tests/self-check-cleanup.tap: Likewise.
* tests/self-check-dir.tap: Likewise.
* tests/self-check-env-sanitize.tap: Likewise.
* tests/self-check-exit.tap: Likewise.
* tests/self-check-me.tap: Likewise.
* tests/self-check-reexec.tap: Likewise.
---
ChangeLog | 22 ++++++++++++++++++++++
Makefile.in | 1 +
configure | 6 ++++++
configure.ac | 4 ++++
doc/Makefile.in | 1 +
lib/Automake/Makefile.in | 1 +
lib/Automake/tests/Makefile.in | 1 +
lib/Makefile.in | 1 +
lib/am/Makefile.in | 1 +
m4/Makefile.in | 1 +
tests/Makefile.am | 5 +++--
tests/Makefile.in | 6 ++++--
tests/defs | 12 +++++++-----
tests/defs-static.in | 8 +++++++-
tests/self-check-cleanup.tap | 14 ++++++++------
tests/self-check-dir.tap | 9 +++++----
tests/self-check-env-sanitize.tap | 4 ++--
tests/self-check-exit.tap | 20 +++++++++++---------
tests/self-check-explicit-skips.test | 15 +++++++++------
tests/self-check-me.tap | 7 ++++---
tests/self-check-reexec.tap | 18 ++++++++++++------
tests/self-check-sanity.test | 8 ++++----
tests/self-check-tap.test | 16 +++++++++-------
23 files changed, 124 insertions(+), 57 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 59e5fb5..df8dbf6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2011-10-17 Stefano Lattarini <address@hidden>
+
+ tests: shell running test scripts is now named AM_TEST_RUNNER_SHELL
+ This is just a preparatory refactoring for future changes.
+ * configure.ac (AM_TEST_RUNNER_SHELL): New variable, defined to
+ `$SHELL', and AC_SUBST'd.
+ * tests/Makefile.am (LOG_COMPILER): Redefine from $(SHELL) to
+ $(AM_TEST_RUNNER_SHELL).
+ (do_subst): Also substitute address@hidden@'.
+ * tests/defs: Adjust to use $AM_TEST_RUNNER_SHELL instead
+ of $CONFIG_SHELL and/or $SHELL, where appropriate. Minor
+ opportunistic changes.
+ * tests/self-check-explicit-skips.test: Likewise.
+ * tests/self-check-sanity.test: Likewise.
+ * tests/self-check-tap.test: Likewise.
+ * tests/self-check-cleanup.tap: Likewise.
+ * tests/self-check-dir.tap: Likewise.
+ * tests/self-check-env-sanitize.tap: Likewise.
+ * tests/self-check-exit.tap: Likewise.
+ * tests/self-check-me.tap: Likewise.
+ * tests/self-check-reexec.tap: Likewise.
+
2011-10-07 Stefano Lattarini <address@hidden>
parallel-tests: warn on conditional TEST_EXTENSIONS definition
diff --git a/Makefile.in b/Makefile.in
index 96278de..97aae10 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -167,6 +167,7 @@ distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AM_TEST_RUNNER_SHELL = @AM_TEST_RUNNER_SHELL@
APIVERSION = @APIVERSION@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
diff --git a/configure b/configure
index 489d7fa..678574a 100755
--- a/configure
+++ b/configure
@@ -569,6 +569,7 @@ ac_unique_file="automake.in"
ac_subst_vars='LTLIBOBJS
LIBOBJS
sh_errexit_works
+AM_TEST_RUNNER_SHELL
FGREP
EGREP
GREP
@@ -2817,6 +2818,11 @@ $as_echo "$ac_cv_path_FGREP" >&6; }
+# Shell used to run our test scripts. The same as $SHELL/$CONFIG_SHELL
+# for the moment.
+AM_TEST_RUNNER_SHELL=$SHELL
+
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $SHELL has working
'set -e' with exit trap" >&5
$as_echo_n "checking whether $SHELL has working 'set -e' with exit trap... "
>&6; }
if ${am_cv_sh_errexit_works+:} false; then :
diff --git a/configure.ac b/configure.ac
index 54f39e5..0379f5d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -186,6 +186,10 @@ AC_SUBST([MODIFICATION_DELAY])
AC_PROG_EGREP
AC_PROG_FGREP
+# Shell used to run our test scripts. The same as $SHELL/$CONFIG_SHELL
+# for the moment.
+AC_SUBST([AM_TEST_RUNNER_SHELL], [$SHELL])
+
AC_CACHE_CHECK([whether $SHELL has working 'set -e' with exit trap],
[am_cv_sh_errexit_works],
[if $SHELL -ec "trap 'exit \$?' 0; (exit 77); exit 77"; test $? = 77
diff --git a/doc/Makefile.in b/doc/Makefile.in
index a156070..bd53c47 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -149,6 +149,7 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS)
$(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AM_TEST_RUNNER_SHELL = @AM_TEST_RUNNER_SHELL@
APIVERSION = @APIVERSION@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
diff --git a/lib/Automake/Makefile.in b/lib/Automake/Makefile.in
index d1c68f9..d520283 100644
--- a/lib/Automake/Makefile.in
+++ b/lib/Automake/Makefile.in
@@ -148,6 +148,7 @@ am__relativize = \
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AM_TEST_RUNNER_SHELL = @AM_TEST_RUNNER_SHELL@
APIVERSION = @APIVERSION@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
diff --git a/lib/Automake/tests/Makefile.in b/lib/Automake/tests/Makefile.in
index 15f2b78..cf978dc 100644
--- a/lib/Automake/tests/Makefile.in
+++ b/lib/Automake/tests/Makefile.in
@@ -187,6 +187,7 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS)
$(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AM_TEST_RUNNER_SHELL = @AM_TEST_RUNNER_SHELL@
APIVERSION = @APIVERSION@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
diff --git a/lib/Makefile.in b/lib/Makefile.in
index 1fc83f4..ab5d68f 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -151,6 +151,7 @@ am__relativize = \
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AM_TEST_RUNNER_SHELL = @AM_TEST_RUNNER_SHELL@
APIVERSION = @APIVERSION@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
diff --git a/lib/am/Makefile.in b/lib/am/Makefile.in
index ff18408..8027d65 100644
--- a/lib/am/Makefile.in
+++ b/lib/am/Makefile.in
@@ -108,6 +108,7 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS)
$(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AM_TEST_RUNNER_SHELL = @AM_TEST_RUNNER_SHELL@
APIVERSION = @APIVERSION@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
diff --git a/m4/Makefile.in b/m4/Makefile.in
index c55b3ed..17a5a79 100644
--- a/m4/Makefile.in
+++ b/m4/Makefile.in
@@ -109,6 +109,7 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS)
$(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AM_TEST_RUNNER_SHELL = @AM_TEST_RUNNER_SHELL@
APIVERSION = @APIVERSION@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e0460dd..9896d7d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -16,8 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Run the tests with the shell detected at configure time.
-LOG_COMPILER = $(SHELL)
+# Run the tests with a proper shell detected at configure time.
+LOG_COMPILER = $(AM_TEST_RUNNER_SHELL)
TEST_EXTENSIONS = .test .tap
TEST_LOG_COMPILER = $(LOG_COMPILER)
@@ -133,6 +133,7 @@ do_subst = sed \
-e 's|@address@hidden|$(build_alias)|g' \
-e 's|@address@hidden|$(APIVERSION)|g' \
-e 's|@address@hidden|$(PATH_SEPARATOR)|g' \
+ -e 's|@address@hidden|$(AM_TEST_RUNNER_SHELL)|g' \
-e 's|@address@hidden|$(SHELL)|g' \
-e 's|@address@hidden|$(PERL)|g' \
-e 's|@address@hidden|$(EGREP)|g' \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 1cfe2dc..198b0eb 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -193,6 +193,7 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS)
$(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AM_TEST_RUNNER_SHELL = @AM_TEST_RUNNER_SHELL@
APIVERSION = @APIVERSION@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
@@ -293,8 +294,8 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-# Run the tests with the shell detected at configure time.
-LOG_COMPILER = $(SHELL)
+# Run the tests with a proper shell detected at configure time.
+LOG_COMPILER = $(AM_TEST_RUNNER_SHELL)
TEST_EXTENSIONS = .test .tap
TEST_LOG_COMPILER = $(LOG_COMPILER)
TAP_LOG_COMPILER = $(LOG_COMPILER)
@@ -1642,6 +1643,7 @@ do_subst = sed \
-e 's|@address@hidden|$(build_alias)|g' \
-e 's|@address@hidden|$(APIVERSION)|g' \
-e 's|@address@hidden|$(PATH_SEPARATOR)|g' \
+ -e 's|@address@hidden|$(AM_TEST_RUNNER_SHELL)|g' \
-e 's|@address@hidden|$(SHELL)|g' \
-e 's|@address@hidden|$(PERL)|g' \
-e 's|@address@hidden|$(EGREP)|g' \
diff --git a/tests/defs b/tests/defs
index e5f66a5..f2c1ff7 100644
--- a/tests/defs
+++ b/tests/defs
@@ -22,7 +22,7 @@
########################################################
# NOTE: This file should execute correctly with any system's /bin/sh
-# shell, and not only with configure-time detected $CONFIG_SHELL,
+# shell, and not only with configure-time detected $AM_TEST_RUNNER_SHELL,
# *until differently and explicitly specified*.
## -------------------------------------------------------- ##
@@ -105,16 +105,16 @@ case ${AM_TESTS_REEXEC-yes} in
*x*) opts=-x;;
*) opts=;;
esac
- echo $me: exec $SHELL $opts "$0" "$*"
- exec $SHELL $opts "$0" ${1+"$@"} || {
- echo "$me: failed to re-execute with $SHELL" >&2
+ echo $me: exec $AM_TEST_RUNNER_SHELL $opts "$0" "$*"
+ exec $AM_TEST_RUNNER_SHELL $opts "$0" ${1+"$@"} || {
+ echo "$me: failed to re-execute with $AM_TEST_RUNNER_SHELL" >&2
exit 99
}
;;
esac
# NOTE: From this point on, we can assume this file is being executed
-# by the configure-time detected $CONFIG_SHELL.
+# by the configure-time detected $AM_TEST_RUNNER_SHELL.
## ----------------------- ##
@@ -245,6 +245,8 @@ is_newest ()
# --------------------------------
# Return success if the given signal number is blocked in the shell,
# return a non-zero exit status and print a proper diagnostic otherwise.
+# Use $AM_TEST_RUNNER_SHELL to do the test, since that is expected to have
+# fewer bugs than a random system's /bin/sh shell.
is_blocked_signal ()
{
# Use perl, since trying to do this portably in the shell can be
diff --git a/tests/defs-static.in b/tests/defs-static.in
index df2fd43..e65285a 100644
--- a/tests/defs-static.in
+++ b/tests/defs-static.in
@@ -24,7 +24,8 @@
# - Multiple inclusions of this file should be idempotent.
# - This code has to be 'set -e' clean.
# - This file should execute correctly with any system's /bin/sh
-# shell, not only with configure-time detected $CONFIG_SHELL.
+# shell, not only with configure-time detected $SHELL and/or
+# $AM_TEST_RUNNER_SHELL.
# Be more Bourne compatible.
# (Snippet inspired to configure's initialization in Autoconf 2.64)
@@ -136,6 +137,11 @@ PATH_SEPARATOR='@PATH_SEPARATOR@'
host_alias=${host_alias-'@host_alias@'}; export host_alias
build_alias=${build_alias-'@build_alias@'}; export build_alias
+# 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@'
+
# 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
# e.g., $SHELL=/bin/tcsh).
diff --git a/tests/self-check-cleanup.tap b/tests/self-check-cleanup.tap
index d369c9f..d7123bb 100755
--- a/tests/self-check-cleanup.tap
+++ b/tests/self-check-cleanup.tap
@@ -63,7 +63,7 @@ cd ..
chmod 000 $dir/sub/* $dir/file $dir/symlink
chmod 000 $dir/sub $dir
command_ok_ "pre-cleanup can deal with null-perms testdir" \
- $SHELL -c '. ./defs' dummy.test
+ $AM_TEST_RUNNER_SHELL -c '. ./defs' dummy.test
command_ok_ "pre-cleanup removed null-perms testdir" \
eval 'test ! -f $dir && test ! -d $dir && test ! -r $dir'
@@ -72,7 +72,7 @@ do_clean
# Check that post-test cleanup works also with directories with
# "null" permissions, and containing broken symlinks.
command_ok_ "post-cleanup can deal with null-perms testdir" \
- $SHELL -c '
+ $AM_TEST_RUNNER_SHELL -c '
stderr_fileno_=2
. ./defs || Exit 1
set -e
@@ -108,7 +108,7 @@ if test $have_symlinks = yes; then
cd ..
command_ok_ "pre-cleanup with testdir with zero-perms symlinks" \
- $SHELL -c '. ./defs' dummy.test
+ $AM_TEST_RUNNER_SHELL -c '. ./defs' dummy.test
ls -l # For debugging.
command_ok_ "pre-cleanup chmod doesn't follow symlinks to files" \
eval 'ls -l file | grep "^----------.*file"'
@@ -116,7 +116,7 @@ if test $have_symlinks = yes; then
eval 'ls -ld dir | grep "^d---------.*dir"'
command_ok_ "post-cleanup with testdir with zero-perms symlinks" \
- $SHELL -c '
+ $AM_TEST_RUNNER_SHELL -c '
ocwd=`pwd` || exit 1
stderr_fileno_=2
. ./defs || Exit 1
@@ -142,7 +142,8 @@ do_clean
# or when receiving a signal.
for st in 1 2 3 10 77 99 126 127 130 255; do
- command_ok_ "exit trap doesn't clobber exit status $st" not $SHELL -c "
+ command_ok_ "exit trap doesn't clobber exit status $st" \
+ not $AM_TEST_RUNNER_SHELL -c "
stderr_fileno_=2
. ./defs
: > foo
@@ -158,7 +159,8 @@ for sig in 1 2 3 9 13 15; do
skip_row_ 2 -r "signal $sig seems blocked"
continue
fi
- command_ok_ "exit trap doesn't clobber signal $sig" not $SHELL -c "
+ command_ok_ "exit trap doesn't clobber signal $sig" \
+ not $AM_TEST_RUNNER_SHELL -c "
stderr_fileno_=2
. ./defs
: > foo
diff --git a/tests/self-check-dir.tap b/tests/self-check-dir.tap
index e698b0c..a697c3f 100755
--- a/tests/self-check-dir.tap
+++ b/tests/self-check-dir.tap
@@ -26,16 +26,17 @@ plan_ 5
AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
-# This needs to be consistent with what $SHELL deems to be the
-# current working directory.
-cwd=`$SHELL -c 'pwd'` || fatal_ "can't get current working directory"
+# This needs to be consistent with what $AM_TEST_RUNNER_SHELL
+# deems to be the current working directory.
+cwd=`$AM_TEST_RUNNER_SHELL -c 'pwd'` \
+ || fatal_ "can't get current working directory"
echo "$cwd"
do_check ()
{
test ! -d _self.dir || rm -rf _self.dir \
|| framework_failure_ "cleaning up _self.dir"
- command_ok_ "$1 [$2]" $SHELL -c "
+ command_ok_ "$1 [$2]" $AM_TEST_RUNNER_SHELL -c "
$2
. ./defs || Exit 99
pwd; ls -l; # For debugging.
diff --git a/tests/self-check-env-sanitize.tap
b/tests/self-check-env-sanitize.tap
index 8736c54..2241b51 100755
--- a/tests/self-check-env-sanitize.tap
+++ b/tests/self-check-env-sanitize.tap
@@ -40,12 +40,12 @@ vars='
do_run ()
{
- env "$1=foo" $SHELL -c '. ./defs' foo.test
+ env "$1=foo" $AM_TEST_RUNNER_SHELL -c '. ./defs' foo.test
}
do_grep ()
{
- env "$1=foo" $SHELL -c '. ./defs' foo.test 2>&1 1>&5 \
+ env "$1=foo" $AM_TEST_RUNNER_SHELL -c '. ./defs' foo.test 2>&1 1>&5 \
| grep "foo\.test:.* variable \`$1'.* in the environment.*unsafe"
}
diff --git a/tests/self-check-exit.tap b/tests/self-check-exit.tap
index 9fe2905..6ae290d 100755
--- a/tests/self-check-exit.tap
+++ b/tests/self-check-exit.tap
@@ -39,7 +39,7 @@ init='stderr_fileno_=2; unset am_explicit_skips; . ./defs'
for st in 1 2 3 4 5 77 99 126 127 128 129 130 255; do
for exit_cmd in "Exit $st" "sh -c 'exit $st'"; do
- $SHELL -c "$init; $exit_cmd; :"
+ $AM_TEST_RUNNER_SHELL -c "$init; $exit_cmd; :"
command_ok_ "$exit_cmd" test $? -eq $st
done
done
@@ -50,12 +50,12 @@ for sig in 1 2 13 15; do
continue
fi
if test $sig -eq 2; then
- # Some Korn shells might otherwise get a spurious SIGINT signal when
- # one is sent to the child $SHELL. For more details, see:
+ # Some Korn shells might otherwise get a spurious SIGINT when one is
+ # sent to the child $AM_TEST_RUNNER_SHELL. For more details, see:
# <http://lists.gnu.org/archive/html/bug-autoconf/2011-09/msg00004.html>
trap : 2
fi
- $SHELL -c "$init; kill -$sig \$\$; :"
+ $AM_TEST_RUNNER_SHELL -c "$init; kill -$sig \$\$; :"
rc=$?
if test $sig -eq 2; then
# Reset default SIGINT handler as portably as possible.
@@ -84,25 +84,27 @@ done
# 3. a non-existing command is issued.
# Note that the non-existent command is issued as the last command to
# the shell in the next line; this is deliberate.
-if $SHELL -c 'set -e; trap "exit \$?" 0; non-existent-program'; then
+# FIXME: remove this workaround once we have a better configure-time
+# determination of `$AM_TEST_RUNNER_SHELL'.
+if $AM_TEST_RUNNER_SHELL -c 'set -e; trap "exit \$?" 0; non-existent-program';
then
maybe_todo=TODO reason="known Solaris /bin/sh bug"
else
maybe_todo="" reason=""
fi
-$SHELL -c "$init; non-existent-program; :"
+$AM_TEST_RUNNER_SHELL -c "$init; non-existent-program; :"
command_ok_ "command not found" -D "$maybe_todo" -r "$reason" \
-- test $? -gt 0
: Non-executable command.
test -f Makefile && test ! -x Makefile || \
framowork_failure_ "no proper Makefile in the current directory"
-$SHELL -c "$init; ./Makefile; :"
+$AM_TEST_RUNNER_SHELL -c "$init; ./Makefile; :"
command_ok_ "permission denied" test $? -gt 0
: Syntax errors in the test code.
-$SHELL -c "$init; if :; then"
+$AM_TEST_RUNNER_SHELL -c "$init; if :; then"
command_ok_ "syntax error 1" test $? -gt 0
-$SHELL -c "$init; fi"
+$AM_TEST_RUNNER_SHELL -c "$init; fi"
command_ok_ "syntax error 2" test $? -gt 0
:
diff --git a/tests/self-check-explicit-skips.test
b/tests/self-check-explicit-skips.test
index 530048d..7766983 100755
--- a/tests/self-check-explicit-skips.test
+++ b/tests/self-check-explicit-skips.test
@@ -33,22 +33,25 @@ set +e
unset am_explicit_skips stderr_fileno_
AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
-$SHELL -c '. ./defs; (exit 77); exit 77' dummy.test
+# I'm a lazy typist.
+sh=$AM_TEST_RUNNER_SHELL
+
+$sh -c '. ./defs; (exit 77); exit 77' dummy.test
test $? -eq 77 || Exit 1
-am_explicit_skips=no $SHELL -c '. ./defs; sh -c "exit 77"' dummy.test
+am_explicit_skips=no $sh -c '. ./defs; sh -c "exit 77"' dummy.test
test $? -eq 77 || Exit 1
-am_explicit_skips=yes $SHELL -c '. ./defs; (exit 77); exit 77' dummy.test
+am_explicit_skips=yes $sh -c '. ./defs; (exit 77); exit 77' dummy.test
test $? -eq 78 || Exit 1
-am_explicit_skips=y $SHELL -c '. ./defs; sh -c "exit 77"' dummy.test
+am_explicit_skips=y $sh -c '. ./defs; sh -c "exit 77"' dummy.test
test $? -eq 78 || Exit 1
-am_explicit_skips=yes $SHELL -c '. ./defs; Exit 77' dummy.test
+am_explicit_skips=yes $sh -c '. ./defs; Exit 77' dummy.test
test $? -eq 77 || Exit 1
-am_explicit_skips=y $SHELL -c '. ./defs; skip_ "foo"' dummy.test
+am_explicit_skips=y $sh -c '. ./defs; skip_ "foo"' dummy.test
test $? -eq 77 || Exit 1
:
diff --git a/tests/self-check-me.tap b/tests/self-check-me.tap
index f681f06..1ccbc7f 100755
--- a/tests/self-check-me.tap
+++ b/tests/self-check-me.tap
@@ -32,7 +32,7 @@ set +e
do_check ()
{
- $SHELL -c '. ./defs && echo me=$me' "$1" | grep "^me=$2$"
+ $AM_TEST_RUNNER_SHELL -c '. ./defs && echo me=$me' "$1" | grep "^me=$2$"
command_ok_ "me=$1" test $? -eq 0
}
@@ -44,7 +44,8 @@ do_check a.b.c.test 'a\.b\.c'
# If we override $me, ./defs should not modify it.
-s=`$SHELL -c 'me=foo.test && . ./defs && echo me=$me' bad.test`
+s=`$AM_TEST_RUNNER_SHELL -c \
+ 'me=foo.test && . ./defs && echo me=$me' bad.test`
command_ok_ "override of \$me before ./defs causes no error" \
test $? -eq 0
@@ -55,7 +56,7 @@ result_ "$r" "override of \$me before ./defs is honored"
unset r
# Overriding $me after sourcing ./defs-static should work.
-s=`$SHELL -c '. ./defs-static && me=zardoz &&
+s=`$AM_TEST_RUNNER_SHELL -c '. ./defs-static && me=zardoz &&
. ./defs && echo me=$me' bad.test`
command_ok_ "override of \$me after ./defs-static causes no error" \
test $? -eq 0
diff --git a/tests/self-check-reexec.tap b/tests/self-check-reexec.tap
index 0982719..fab7cc3 100755
--- a/tests/self-check-reexec.tap
+++ b/tests/self-check-reexec.tap
@@ -16,7 +16,7 @@
# Sanity check for the automake testsuite.
# Check that automatic re-execution of test script with the
-# configure-time $SHELL.
+# configure-time $AM_TEST_RUNNER_SHELL.
am_create_testdir=empty
. ./defs || Exit 1
@@ -32,7 +32,9 @@ cp ../defs .
# Search for required bash and non-bash shells.
#
-for bash_shell in "$SHELL" bash bash3 bash4 :; do
+for bash_shell in \
+ "$SHELL" "$AM_TEST_RUNNER_SHELL" bash bash3 bash4 :
+do
test "$bash_shell" = : && break
$bash_shell --version || continue
$bash_shell -c 'test -n "$BASH_VERSION"' || continue
@@ -41,7 +43,9 @@ done
# This might not be optimal, but it's much better than writing wrapper
# scripts acting as "fake" shells.
-for non_bash_shell in /bin/sh /bin/ksh "$SHELL" sh ksh ash dash pdksh :; do
+for non_bash_shell in \
+ /bin/sh /bin/ksh sh ksh ash dash pdksh "$SHELL" "$AM_TEST_RUNNER_SHELL" :
+do
test "$non_bash_shell" = : && break
$non_bash_shell -c 'exit 0' || continue
$non_bash_shell -c 'test -n "$BASH_VERSION"' && continue
@@ -97,8 +101,9 @@ cat > need-bash.test <<'END'
(foo=abac && test xbxc = ${foo//a/x} && test -n "$BASH_VERSION")
END
+sh_var=AM_TEST_RUNNER_SHELL
sed -e "s|^testbuilddir=.*|testbuilddir='$cwd'|" \
- -e 's|^SHELL=.*$|SHELL=bash; export SHELL|' \
+ -e "s|^$sh_var=.*$|$sh_var=bash; export $sh_var|" \
< ../defs-static >defs-static
do_reexec ()
@@ -169,12 +174,13 @@ check_reexec_message ()
dir=$1; shift
get_ddata "$dir"
$sh "${dir}${dsep}dummy.test" "$@" \
- | grep "^dummy: exec $SHELL ${dir}${dsep}dummy\\.test $*\$" \
+ | grep "^dummy: exec $AM_TEST_RUNNER_SHELL ${dir}${dsep}dummy\\.test $*\$"
\
&& r='ok' || r='not ok'
result_ "$r" "$sh display re-exec message [$dname] [args: $*]"
}
-./dummy.test a b | grep "^dummy: exec $SHELL \\./dummy\\.test a b$" \
+./dummy.test a b \
+ | grep "^dummy: exec $AM_TEST_RUNNER_SHELL \\./dummy\\.test a b$" \
&& r='ok' || r='not ok'
result_ "$r" "direct run display re-exec message [args: a b]"
diff --git a/tests/self-check-sanity.test b/tests/self-check-sanity.test
index 8626914..4c553e3 100755
--- a/tests/self-check-sanity.test
+++ b/tests/self-check-sanity.test
@@ -30,7 +30,7 @@ show_stderr ()
AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
-if $SHELL -c '. ../defs' dummy.test 2>stderr; then
+if $AM_TEST_RUNNER_SHELL -c '. ../defs' dummy.test 2>stderr; then
show_stderr
Exit 1
else
@@ -39,7 +39,7 @@ else
fi
sed 's|^testsrcdir=.*|testsrcdir=foo|' ../defs-static > defs-static
-if $SHELL -c '. ../defs' dummy.test 2>stderr; then
+if $AM_TEST_RUNNER_SHELL -c '. ../defs' dummy.test 2>stderr; then
show_stderr
Exit 1
else
@@ -48,7 +48,7 @@ else
fi
sed 's|^testbuilddir=.*|testbuilddir=foo|' ../defs-static > defs-static
-if $SHELL -c '. ../defs' dummy.test 2>stderr; then
+if $AM_TEST_RUNNER_SHELL -c '. ../defs' dummy.test 2>stderr; then
show_stderr
Exit 1
else
@@ -66,7 +66,7 @@ env \
top_builddir=bad-dir top_srcdir=bad-dir \
abs_builddir=bad-dir abs_srcdir=bad-dir \
abs_top_builddir=bad-dir abs_top_srcdir=bad-dir \
- $SHELL -c '. ../defs && echo "!OK!" > ../foo' dummy.test
+ $AM_TEST_RUNNER_SHELL -c '. ../defs && echo "!OK!" > ../foo' dummy.test
$FGREP '!OK!' foo
:
diff --git a/tests/self-check-tap.test b/tests/self-check-tap.test
index 29350ef..1409e1b 100755
--- a/tests/self-check-tap.test
+++ b/tests/self-check-tap.test
@@ -22,19 +22,21 @@
set -ex
-$SHELL -c '. ./defs-static && test $am_using_tap = yes' foo.tap
-$SHELL -c '. ./defs-static && test $am_using_tap = no' foo.test
-$SHELL -c '. ./defs-static && test $am_using_tap = no' tap
-$SHELL -c '. ./defs-static && test $am_using_tap = no' tap.test
-$SHELL -c '. ./defs-static && test $am_using_tap = no' foo-tap
+$AM_TEST_RUNNER_SHELL -c \
+ '. ./defs-static && test $am_using_tap = yes' foo.tap
-$SHELL -c '
+for name in foo.test tap tap.test foo-tap; do
+ $AM_TEST_RUNNER_SHELL -c \
+ '. ./defs-static && test $am_using_tap = no' $name
+done
+
+$AM_TEST_RUNNER_SHELL -c '
am_using_tap=no
. ./defs-static
test $am_using_tap = no
' foo.tap
-$SHELL -c '
+$AM_TEST_RUNNER_SHELL -c '
am_using_tap=yes
. ./defs-static
test $am_using_tap = yes
--
1.7.2.3