summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/input-tty10
-rwxr-xr-xtests/misc/stty2
-rwxr-xr-xtests/misc/stty-invalid3
-rwxr-xr-xtests/misc/stty-row-col3
-rwxr-xr-xtests/mv/i-32
-rw-r--r--tests/test-lib.sh13
7 files changed, 17 insertions, 17 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8a5835624..bc656c427 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -11,7 +11,6 @@ EXTRA_DIST = \
README \
check.mk \
envvar-check \
- input-tty \
lang-default \
other-fs-tmpdir \
require-perl \
diff --git a/tests/input-tty b/tests/input-tty
deleted file mode 100644
index 7df151523..000000000
--- a/tests/input-tty
+++ /dev/null
@@ -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
diff --git a/tests/misc/stty b/tests/misc/stty
index 8b5fbff00..8216c8e81 100755
--- a/tests/misc/stty
+++ b/tests/misc/stty
@@ -22,8 +22,8 @@ if test "$VERBOSE" = yes; then
fi
# Make sure there's a tty on stdin.
-. $srcdir/input-tty
. $srcdir/test-lib.sh
+require_controlling_input_terminal_
# The following list of reversible options was generated with
# grep -w REV stty.c|sed -n '/^ {"/{s//REV_/;s/".*/=1/;p;}'|fmt
diff --git a/tests/misc/stty-invalid b/tests/misc/stty-invalid
index 168bb59af..302dbe0ec 100755
--- a/tests/misc/stty-invalid
+++ b/tests/misc/stty-invalid
@@ -21,9 +21,8 @@ if test "$VERBOSE" = yes; then
stty --version
fi
-# Make sure there's a tty on stdin.
-. $srcdir/input-tty
. $srcdir/test-lib.sh
+require_controlling_input_terminal_
fail=0
diff --git a/tests/misc/stty-row-col b/tests/misc/stty-row-col
index 7fc917fa4..8ac114336 100755
--- a/tests/misc/stty-row-col
+++ b/tests/misc/stty-row-col
@@ -36,9 +36,8 @@ export COLUMNS
LC_ALL=C
export LC_ALL
-# Make sure there's a tty on stdin.
-. $srcdir/input-tty
. $srcdir/test-lib.sh
+require_controlling_input_terminal_
# Versions of GNU stty from shellutils-1.9.2c and earlier failed
# tests #2 and #4 when run on SunOS 4.1.3.
diff --git a/tests/mv/i-3 b/tests/mv/i-3
index eed3c8b66..9d8b03ecd 100755
--- a/tests/mv/i-3
+++ b/tests/mv/i-3
@@ -22,8 +22,8 @@ if test "$VERBOSE" = yes; then
mv --version
fi
-. $srcdir/input-tty
. $srcdir/test-lib.sh
+require_controlling_input_terminal_
skip_if_root_
touch f g h i || framework_failure
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
index f38693334..f0e107061 100644
--- a/tests/test-lib.sh
+++ b/tests/test-lib.sh
@@ -57,6 +57,19 @@ require_strace_()
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_()
{
skip_=no