diff options
Diffstat (limited to 'tests/misc')
-rwxr-xr-x | tests/misc/tee-dash.sh | 24 | ||||
-rwxr-xr-x | tests/misc/tee.sh | 25 |
2 files changed, 16 insertions, 33 deletions
diff --git a/tests/misc/tee-dash.sh b/tests/misc/tee-dash.sh deleted file mode 100755 index 1063211cf..000000000 --- a/tests/misc/tee-dash.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# test for "tee -". - -# Copyright (C) 2005-2015 Free Software Foundation, Inc. - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src -print_ver_ tee - -tee - </dev/null || fail=1 - -Exit $fail diff --git a/tests/misc/tee.sh b/tests/misc/tee.sh index 5f2eeda7b..ecca6562b 100755 --- a/tests/misc/tee.sh +++ b/tests/misc/tee.sh @@ -20,17 +20,24 @@ print_ver_ tee echo line >sample || framework_failure_ -nums=$(seq 9) || framework_failure_ - -for n in 0 $nums; do - files=$(seq $n) - rm -f $files - tee $files <sample >out || fail=1 - for f in out $files; do - compare sample $f || fail=1 - done + +# POSIX says: "Processing of at least 13 file operands shall be supported." +for n in 0 1 2 12 13; do + files=$(seq $n) + rm -f $files + tee $files <sample >out || fail=1 + for f in out $files; do + compare sample $f || fail=1 + done done +# Ensure tee treats '-' as the name of a file, as mandated by POSIX. +# Between v5.3.0 and v8.23, a '-' argument caused tee to send another +# copy of input to standard output. +tee - <sample >out 2>err || fail=1 +compare sample ./- || fail=1 +compare sample out || fail=1 +compare /dev/null err || fail # Ensure tee exits early if no more writable outputs if test -w /dev/full && test -c /dev/full; then |