]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: fix recent tail-2 test regressions
authorPádraig Brady <P@draigBrady.com>
Sat, 19 Nov 2016 11:14:49 +0000 (11:14 +0000)
committerPádraig Brady <P@draigBrady.com>
Tue, 22 Nov 2016 20:04:25 +0000 (20:04 +0000)
* tests/tail-2/pipe-f.sh: Avoid issue with readable
directories on BSD systems.
* tests/tail-2/retry.sh: Likewise.
Reported by Assaf Gordon

tests/tail-2/pipe-f.sh
tests/tail-2/retry.sh

index 82364dacce594eed9bc973bb1efca373ae7e81ad..3c982661813014ea2b9f070f51cf1b2d45ce95b5 100755 (executable)
@@ -23,13 +23,10 @@ echo oo > exp || framework_failure_
 echo foo | timeout 10 tail -f -c3 > out || fail=1
 compare exp out || fail=1
 
-cat <<\EOF > exp
+cat <<\EOF > exp || framework_failure_
 ==> standard input <==
 ar
-
-==> missing <==
 EOF
-mkdir missing || framework_failure_
 echo bar | returns_ 1 timeout 10 tail -f -c3 - missing > out || fail=1
 compare exp out || fail=1
 
index 7829923566c1660972b78616726e93445acd76ec..1ab09ddacab9a8252ae47914270b5e3cf1a381db 100755 (executable)
@@ -148,6 +148,7 @@ returns_ 1 tail $mode --follow=descriptor missing >out 2>&1 || fail=1
 [ "$(countlines_)" = 2 ]         || { fail=1; cat out; }
 grep -F 'cannot open' out        || { fail=1; cat out; }
 grep -F 'no files remaining' out || { fail=1; cat out; }
+rm -f out                        || framework_failure_
 
 # === Test:
 # Likewise for --follow=name (without --retry).
@@ -155,10 +156,12 @@ returns_ 1 tail $mode --follow=name missing >out 2>&1 || fail=1
 [ "$(countlines_)" = 2 ]         || { fail=1; cat out; }
 grep -F 'cannot open' out        || { fail=1; cat out; }
 grep -F 'no files remaining' out || { fail=1; cat out; }
+rm -f out                        || framework_failure_
 
 # === Test:
 # Ensure that tail -F retries when the file is initially untailable.
-mkdir untailable
+if ! cat . >/dev/null; then
+mkdir untailable || framework_failure_
 timeout 10 \
   tail $mode $fastpoll -F untailable >out 2>&1 & pid=$!
 # Wait for "cannot open" error.
@@ -172,6 +175,7 @@ grep -F 'cannot follow' out                    || { fail=1; cat out; }
 grep -F 'has become accessible' out            || { fail=1; cat out; }
 grep -F 'foo' out                              || { fail=1; cat out; }
 rm -fd untailable out                          || framework_failure_
+fi
 
 done