tests: move input-tty into a test-lib.sh function

* tests/test-lib.sh (require_controlling_input_terminal_): New function, from
* tests/input-tty: ...here.  Remove file.
* tests/Makefile.am (EXTRA_DIST): Remove input-tty.
* tests/mv/i-3: Use the function, not the file.
* tests/misc/stty: Likewise.
* tests/misc/stty-row-col: Likewise.
* tests/misc/stty-invalid: Likewise.
This commit is contained in:
Jim Meyering 2008-09-07 11:54:43 +02:00
parent e4fa3e7808
commit 22e5102f19
7 changed files with 17 additions and 17 deletions

View File

@ -11,7 +11,6 @@ EXTRA_DIST = \
README \ README \
check.mk \ check.mk \
envvar-check \ envvar-check \
input-tty \
lang-default \ lang-default \
other-fs-tmpdir \ other-fs-tmpdir \
require-perl \ require-perl \

View File

@ -1,10 +0,0 @@
# Require a controlling input `terminal'.
tty -s || have_input_tty=no
test -t 1 || have_input_tty=no
if test "$have_input_tty" = no; then
echo "$0: This test must have a controlling input \`terminal'," 1>&2
echo " so it may not be run via \`batch', \`at', or \`rsh'." 1>&2
echo " On some systems, it may not even be run in the background." 1>&2
(exit 77); exit 77
fi

View File

@ -22,8 +22,8 @@ if test "$VERBOSE" = yes; then
fi fi
# Make sure there's a tty on stdin. # Make sure there's a tty on stdin.
. $srcdir/input-tty
. $srcdir/test-lib.sh . $srcdir/test-lib.sh
require_controlling_input_terminal_
# The following list of reversible options was generated with # The following list of reversible options was generated with
# grep -w REV stty.c|sed -n '/^ {"/{s//REV_/;s/".*/=1/;p;}'|fmt # grep -w REV stty.c|sed -n '/^ {"/{s//REV_/;s/".*/=1/;p;}'|fmt

View File

@ -21,9 +21,8 @@ if test "$VERBOSE" = yes; then
stty --version stty --version
fi fi
# Make sure there's a tty on stdin.
. $srcdir/input-tty
. $srcdir/test-lib.sh . $srcdir/test-lib.sh
require_controlling_input_terminal_
fail=0 fail=0

View File

@ -36,9 +36,8 @@ export COLUMNS
LC_ALL=C LC_ALL=C
export LC_ALL export LC_ALL
# Make sure there's a tty on stdin.
. $srcdir/input-tty
. $srcdir/test-lib.sh . $srcdir/test-lib.sh
require_controlling_input_terminal_
# Versions of GNU stty from shellutils-1.9.2c and earlier failed # Versions of GNU stty from shellutils-1.9.2c and earlier failed
# tests #2 and #4 when run on SunOS 4.1.3. # tests #2 and #4 when run on SunOS 4.1.3.

View File

@ -22,8 +22,8 @@ if test "$VERBOSE" = yes; then
mv --version mv --version
fi fi
. $srcdir/input-tty
. $srcdir/test-lib.sh . $srcdir/test-lib.sh
require_controlling_input_terminal_
skip_if_root_ skip_if_root_
touch f g h i || framework_failure touch f g h i || framework_failure

View File

@ -57,6 +57,19 @@ require_strace_()
skip_test_ 'strace -qe "'"$1"'" does not work' skip_test_ 'strace -qe "'"$1"'" does not work'
} }
# Require a controlling input `terminal'.
require_controlling_input_terminal_()
{
tty -s || have_input_tty=no
test -t 1 || have_input_tty=no
if test "$have_input_tty" = no; then
echo "$0: This test must have a controlling input \`terminal'," 1>&2
echo " so it may not be run via \`batch', \`at', or \`rsh'." 1>&2
echo " On some systems, it may not even be run in the background." 1>&2
(exit 77); exit 77
fi
}
require_built_() require_built_()
{ {
skip_=no skip_=no