summaryrefslogtreecommitdiff
path: root/tests/test-lib.sh
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-09-07 11:54:43 +0200
committerJim Meyering <meyering@redhat.com>2008-09-08 08:20:03 +0200
commit22e5102f1961c5552d20c3791cbc99b6b001e83f (patch)
tree199738dcde259cded44e1d925faa7fa68739cb0c /tests/test-lib.sh
parente4fa3e78088d7bc088d40283edcdd7393d6a5741 (diff)
downloadcoreutils-22e5102f1961c5552d20c3791cbc99b6b001e83f.tar.xz
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.
Diffstat (limited to 'tests/test-lib.sh')
-rw-r--r--tests/test-lib.sh13
1 files changed, 13 insertions, 0 deletions
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