summaryrefslogtreecommitdiff
path: root/tests/in-eq-out-infloop
diff options
context:
space:
mode:
Diffstat (limited to 'tests/in-eq-out-infloop')
-rwxr-xr-xtests/in-eq-out-infloop33
1 files changed, 19 insertions, 14 deletions
diff --git a/tests/in-eq-out-infloop b/tests/in-eq-out-infloop
index dcb7ac05..fc7acc6e 100755
--- a/tests/in-eq-out-infloop
+++ b/tests/in-eq-out-infloop
@@ -13,23 +13,28 @@ for i in 1 2 3 4 5 6 7 8 9 10 11 12; do
done
echo "$v" > out || framework_failure_
-echo 'grep: input file `out'\'' is also the output' \
- > err.exp || framework_failure_
-# Require an exit status of 2.
-# grep-2.8 and earlier would infloop.
-timeout 10 grep 0 out >> out 2> err; st=$?
-test $st = 2 || fail=1
+for arg in out - ''; do
+ case $arg in
+ out) echo 'grep: input file `out'\'' is also the output';;
+ *) echo 'grep: input file `(standard input)'\'' is also the output';;
+ esac > err.exp || framework_failure_
-compare err.exp err || fail=1
+ # Require an exit status of 2.
+ # grep-2.8 and earlier would infloop with $arg = out.
+ # grep-2.10 and earlier would infloop with $arg = - or $arg = ''.
+ timeout 10 grep 0 $arg < out >> out 2> err; st=$?
+ test $st = 2 || fail=1
+ compare err.exp err || fail=1
-# But with each of the following options it must not exit-2.
-for i in -q -m1 -l -L; do
- timeout 10 grep $i 0 out >> out 2> err; st=$?
- test $st = 2 && fail=1
-done
+ # But with each of the following options it must not exit-2.
+ for i in -q -m1 -l -L; do
+ timeout 10 grep $i 0 $arg < out >> out 2> err; st=$?
+ test $st = 2 && fail=1
+ done
-timeout 10 grep -2 0 out >> out 2> err; st=$?
-test $st = 2 || fail=1
+ timeout 10 grep -2 0 $arg < out >> out 2> err; st=$?
+ test $st = 2 || fail=1
+done
Exit $fail