diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/misc/tee.sh | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/tests/misc/tee.sh b/tests/misc/tee.sh index 84665cd00..f457a0b7a 100755 --- a/tests/misc/tee.sh +++ b/tests/misc/tee.sh @@ -64,7 +64,7 @@ if test -w /dev/full && test -c /dev/full; then fi -# Ensure tee honors --write-error modes +# Ensure tee honors --output-error modes mkfifo_or_skip_ fifo read_fifo() { timeout 10 dd count=1 if=fifo of=/dev/null status=none & } @@ -73,30 +73,36 @@ read_fifo yes >fifo pipe_status=$? -# Default operation is to exit silently on SIGPIPE +# Default operation is to continue on output errors but exit silently on SIGPIPE read_fifo -yes | returns_ $pipe_status timeout 10 tee 2>err >fifo || fail=1 -test $(wc -l < err) = 0 || { cat err; fail=1; } +yes | returns_ $pipe_status timeout 10 tee ./e/noent 2>err >fifo || fail=1 +test $(wc -l < err) = 1 || { cat err; fail=1; } # With -p, SIGPIPE is suppressed, exit 0 for EPIPE when all outputs finished read_fifo yes | timeout 10 tee -p 2>err >fifo || fail=1 test $(wc -l < err) = 0 || { cat err; fail=1; } -# With --write-error=warn, exit 1 for EPIPE when all outputs finished +# With --output-error=warn, exit 1 for EPIPE when all outputs finished +read_fifo +yes | returns_ 1 timeout 10 tee --output-error=warn 2>err >fifo || fail=1 +test $(wc -l < err) = 1 || { cat err; fail=1; } + +# With --output-error=exit, exit 1 immediately for EPIPE read_fifo -yes | returns_ 1 timeout 10 tee --write-error=warn 2>err >fifo || fail=1 +yes | returns_ 1 timeout 10 tee --output-error=exit /dev/null 2>err >fifo \ + || fail=1 test $(wc -l < err) = 1 || { cat err; fail=1; } -# With --write-error=exit, exit 1 immediately for EPIPE +# With --output-error=exit, exit 1 immediately on output error read_fifo -yes | returns_ 1 timeout 10 tee --write-error=exit /dev/null 2>err >fifo \ +yes | returns_ 1 timeout 10 tee --output-error=exit ./e/noent 2>err >fifo \ || fail=1 test $(wc -l < err) = 1 || { cat err; fail=1; } -# With --write-error=exit-nopipe, exit 0 for EPIPE +# With --output-error=exit-nopipe, exit 0 for EPIPE read_fifo -yes | timeout 10 tee --write-error=exit-nopipe 2>err >fifo || fail=1 +yes | timeout 10 tee --output-error=exit-nopipe 2>err >fifo || fail=1 test $(wc -l < err) = 0 || { cat err; fail=1; } wait |