summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2011-12-28 13:23:31 +0100
committerStefano Lattarini <stefano.lattarini@gmail.com>2012-05-07 21:38:47 +0200
commit21d1b9342743efdb196110093b3b6ee156688b83 (patch)
tree7aecfeadd08508428dbfa5729e5a6b5fb48b3ea3 /t
parentdda822736d5e66f5b8fa6888397894c09a5fdcaa (diff)
downloadautomake-21d1b9342743efdb196110093b3b6ee156688b83.tar.gz
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. * Makefile.am (LOG_COMPILER): Redefine from $(SHELL) to $(AM_TEST_RUNNER_SHELL). * defs: Adjust to use $AM_TEST_RUNNER_SHELL instead of $CONFIG_SHELL and/or $SHELL, where appropriate. Minor opportunistic changes. * t/self-check-explicit-skips.sh: Likewise. * t/self-check-sanity.sh: Likewise. * t/self-check-tap.sh: Likewise. * t/self-check-cleanup.tap: Likewise. * t/self-check-dir.tap: Likewise. * t/self-check-env-sanitize.tap: Likewise. * t/self-check-exit.tap: Likewise. * t/self-check-me.tap: Likewise. * t/self-check-reexec.tap: Likewise. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Diffstat (limited to 't')
-rwxr-xr-xt/self-check-cleanup.tap17
-rwxr-xr-xt/self-check-dir.tap9
-rwxr-xr-xt/self-check-env-sanitize.tap4
-rwxr-xr-xt/self-check-exit.tap22
-rwxr-xr-xt/self-check-explicit-skips.sh15
-rwxr-xr-xt/self-check-me.tap8
-rwxr-xr-xt/self-check-reexec.tap18
-rwxr-xr-xt/self-check-sanity.sh8
-rwxr-xr-xt/self-check-tap.sh16
9 files changed, 67 insertions, 50 deletions
diff --git a/t/self-check-cleanup.tap b/t/self-check-cleanup.tap
index a56854b47..215472ae1 100755
--- a/t/self-check-cleanup.tap
+++ b/t/self-check-cleanup.tap
@@ -58,7 +58,8 @@ do_clean ()
# the cleanup code not to be run, so that the temporary directories
# are left on disk.
command_ok_ '"keep_testdirs=yes" causes testdir to be kept around' eval '
- keep_testdirs=yes $SHELL -c ". ./defs && echo okok >foo" t/dummy.sh \
+ env keep_testdirs=yes \
+ $AM_TEST_RUNNER_SHELL -c ". ./defs && echo okok >foo" t/dummy.sh \
&& test -f t/dummy.dir/foo \
&& test okok = `cat t/dummy.dir/foo`'
@@ -79,7 +80,7 @@ chmod 000 t/dummy.dir/sub/* t/dummy.dir/file
test $have_symlinks = yes && chmod 000 t/dummy.dir/symlink
chmod 500 t/dummy.dir/sub t/dummy.dir
command_ok_ "pre-cleanup can deal with low-perms testdir" \
- $SHELL -c '. ./defs' t/dummy.sh
+ $AM_TEST_RUNNER_SHELL -c '. ./defs' t/dummy.sh
command_ok_ "pre-cleanup removed low-perms testdir" \
eval 'test ! -f t/dummy.dir \
&& test ! -d t/dummy.dir \
@@ -90,7 +91,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 low-perms testdir" \
- $SHELL -c '
+ $AM_TEST_RUNNER_SHELL -c '
stderr_fileno_=2
. ./defs || Exit 1
set -e
@@ -127,7 +128,7 @@ if test $have_symlinks = yes; then
(cd t/dummy.dir && ln -s ../../dir ../../file .)
command_ok_ "pre-cleanup with testdir with zero-perms symlinks" \
- $SHELL -c '. ./defs' t/dummy.sh
+ $AM_TEST_RUNNER_SHELL -c '. ./defs' t/dummy.sh
ls -l # For debugging.
command_ok_ "pre-cleanup chmod doesn't follow symlinks to files" \
eval 'ls -l file | grep "^----------.*file"'
@@ -135,7 +136,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
@@ -162,7 +163,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
@@ -178,7 +180,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/t/self-check-dir.tap b/t/self-check-dir.tap
index 736238c35..424367eac 100755
--- a/t/self-check-dir.tap
+++ b/t/self-check-dir.tap
@@ -27,16 +27,17 @@ plan_ 5
AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
keep_testdirs=; unset keep_testdirs
-# 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
# Don't fail if 'ls -l' fails; avoids possible racy spurious failures.
diff --git a/t/self-check-env-sanitize.tap b/t/self-check-env-sanitize.tap
index d4e6cdb69..bc7818610 100755
--- a/t/self-check-env-sanitize.tap
+++ b/t/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/t/self-check-exit.tap b/t/self-check-exit.tap
index c866dbc28..029b17424 100755
--- a/t/self-check-exit.tap
+++ b/t/self-check-exit.tap
@@ -38,12 +38,12 @@ AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
init='stderr_fileno_=2; unset am_explicit_skips; . ./defs'
# Required so that the code in defs doesn't go crazy trying to creating a
-# temporary directory in the absolute dir of $SHELL.
+# temporary directory in the absolute dir of $AM_TEST_RUNNER_SHELL.
dummy_test_script=t/$me.sh
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; :" "$dummy_test_script"
+ $AM_TEST_RUNNER_SHELL -c "$init; $exit_cmd; :" "$dummy_test_script"
command_ok_ "$exit_cmd" test $? -eq $st
done
done
@@ -54,12 +54,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 \$\$; :" "$dummy_test_script"
+ $AM_TEST_RUNNER_SHELL -c "$init; kill -$sig \$\$; :" "$dummy_test_script"
rc=$?
if test $sig -eq 2; then
# Reset default SIGINT handler as portably as possible.
@@ -88,25 +88,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; :" "$dummy_test_script"
+$AM_TEST_RUNNER_SHELL -c "$init; non-existent-prog; :" "$dummy_test_script"
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; :" "$dummy_test_script"
+$AM_TEST_RUNNER_SHELL -c "$init; ./Makefile; :" "$dummy_test_script"
command_ok_ "permission denied" test $? -gt 0
: Syntax errors in the test code.
-$SHELL -c "$init; if :; then" "$dummy_test_script"
+$AM_TEST_RUNNER_SHELL -c "$init; if :; then" "$dummy_test_script"
command_ok_ "syntax error 1" test $? -gt 0
-$SHELL -c "$init; fi" "$dummy_test_script"
+$AM_TEST_RUNNER_SHELL -c "$init; fi" "$dummy_test_script"
command_ok_ "syntax error 2" test $? -gt 0
:
diff --git a/t/self-check-explicit-skips.sh b/t/self-check-explicit-skips.sh
index 3e7a77c0a..2b64fe156 100755
--- a/t/self-check-explicit-skips.sh
+++ b/t/self-check-explicit-skips.sh
@@ -35,22 +35,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/t/self-check-me.tap b/t/self-check-me.tap
index 5c83ee6d3..cddc9b5d7 100755
--- a/t/self-check-me.tap
+++ b/t/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
}
@@ -48,7 +48,7 @@ do_check abc. 'abc\.'
# If we override $me, ./defs should not modify it.
-s=`$SHELL -c 'me=foo.sh && . ./defs && echo me=$me' bad.sh`
+s=`$AM_TEST_RUNNER_SHELL -c 'me=foo.sh && . ./defs && echo me=$me' bad.sh`
command_ok_ "override of \$me before ./defs causes no error" \
test $? -eq 0
@@ -59,8 +59,8 @@ 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 &&
- . ./defs && echo me=$me' bad.sh`
+s=`$AM_TEST_RUNNER_SHELL -c '. ./defs-static && me=zardoz &&
+ . ./defs && echo me=$me' bad.sh`
command_ok_ "override of \$me after ./defs-static causes no error" \
test $? -eq 0
diff --git a/t/self-check-reexec.tap b/t/self-check-reexec.tap
index 8237c0812..7b91008ec 100755
--- a/t/self-check-reexec.tap
+++ b/t/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 "$am_top_builddir"/defs . || fatal_ "fetching 'defs' from top_builddir"
# 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.sh <<'END'
(foo=abac && test xbxc = ${foo//a/x} && test -n "$BASH_VERSION")
END
+sh_var=AM_TEST_RUNNER_SHELL
sed -e "s|^am_top_builddir=.*|am_top_builddir='$cwd'|" \
- -e 's|^SHELL=.*$|SHELL=bash; export SHELL|' \
+ -e "s|^$sh_var=.*$|$sh_var=bash; export $sh_var|" \
< "$am_top_builddir"/defs-static >defs-static
do_reexec ()
@@ -169,12 +174,13 @@ check_reexec_message ()
dir=$1; shift
get_ddata "$dir"
$sh "${dir}${dsep}dummy.sh" "$@" \
- | grep "^dummy: exec $SHELL ${dir}${dsep}dummy\\.sh $*\$" \
+ | grep "^dummy: exec $AM_TEST_RUNNER_SHELL ${dir}${dsep}dummy\\.sh $*\$" \
&& r='ok' || r='not ok'
result_ "$r" "$sh display re-exec message [$dname] [args: $*]"
}
-./dummy.sh a b | grep "^dummy: exec $SHELL \\./dummy\\.sh a b$" \
+./dummy.sh a b \
+ | grep "^dummy: exec $AM_TEST_RUNNER_SHELL \\./dummy\\.sh a b$" \
&& r='ok' || r='not ok'
result_ "$r" "direct run display re-exec message [args: a b]"
diff --git a/t/self-check-sanity.sh b/t/self-check-sanity.sh
index 64e489cb7..8e31afa1c 100755
--- a/t/self-check-sanity.sh
+++ b/t/self-check-sanity.sh
@@ -32,7 +32,7 @@ AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
source_defs=". '$am_top_builddir/defs'"
-if $SHELL -c "$source_defs" dummy.test 2>stderr; then
+if $AM_TEST_RUNNER_SHELL -c "$source_defs" dummy.sh 2>stderr; then
show_stderr
Exit 1
else
@@ -42,7 +42,7 @@ fi
sed 's|^am_top_srcdir=.*|am_top_srcdir=foo|' \
"$am_top_builddir"/defs-static > defs-static
-if $SHELL -c "$source_defs" t/dummy.test 2>stderr; then
+if $AM_TEST_RUNNER_SHELL -c "$source_defs" t/dummy.sh 2>stderr; then
show_stderr
Exit 1
else
@@ -52,7 +52,7 @@ fi
sed 's|^am_top_builddir=.*|am_top_builddir=foo|' \
"$am_top_builddir"/defs-static > defs-static
-if $SHELL -c "$source_defs" t/dummy.test 2>stderr; then
+if $AM_TEST_RUNNER_SHELL -c "$source_defs" t/dummy.sh 2>stderr; then
show_stderr
Exit 1
else
@@ -71,7 +71,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 "$source_defs && echo '!OK!' > ../foo" t/dummy.test
+ $AM_TEST_RUNNER_SHELL -c "$source_defs && echo '!OK!' > ../foo" t/dummy.sh
$FGREP '!OK!' t/foo
:
diff --git a/t/self-check-tap.sh b/t/self-check-tap.sh
index 6a2d132fd..d7f788c6b 100755
--- a/t/self-check-tap.sh
+++ b/t/self-check-tap.sh
@@ -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