coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] tests: fix races in and standardize the tail tests


From: Pádraig Brady
Subject: [PATCH] tests: fix races in and standardize the tail tests
Date: Sat, 2 May 2015 10:52:37 +0100

* tests/tail-2/F-vs-missing.sh: Use standard "fastpoll" options
(-s.1 --max-unchanged-stats=1) to speedup the non-inotify case.
Add the non-inotify case to the test. `wait` on the background
tail process to terminate which should avoid the need for the
non standard `retry_delay_ cleanup ...` on NFS.
* tests/tail-2/F-vs-rename.sh: Remove 'out' at the start of the loop,
to avoid a race in checking its contents.  Also ensure 'a' & 'b'
files are present before the tail process starts.  Use the standard
"fastpoll" options as above.
* tests/tail-2/f-vs-rename.sh: Likewise.
* tests/tail-2/append-only.sh: Use more standard variable names.
* tests/tail-2/assert-2.sh: Use timeout(1) rather than sleep;kill.
* tests/tail-2/assert.sh: Likewise.
* tests/tail-2/flush-initial.sh: Use "fastpoll" options for
non-inotify platforms.  Also `wait` on the background tail to avoid
stray processes and file cleanup issues on NFS.
* tests/tail-2/inotify-hash-abuse.sh: Always run non-inotify case.
Use "fastpoll" options.  Add a `wait` on the background tail.
* tests/tail-2/inotify-hash-abuse2.sh: Likewise.
* tests/tail-2/inotify-rotate-resources.sh: Wait just on the
specific tail $pid needed.
* tests/tail-2/inotify-rotate.sh: Use "fastpoll" options.
* tests/tail-2/pid.sh: Use standard variable names.
Add a `wait` on the background tails.
* tests/tail-2/pipe-f2.sh: Likewise.
* tests/tail-2/tail-n0f.sh: Likewise.
* tests/tail-2/wait.sh: Likewise.
* tests/tail-2/retry.sh: Use "fastpoll" options.
* tests/tail-2/symlink.sh: Likewise.
---
 tests/tail-2/F-vs-missing.sh             | 47 ++++++++++++---------------
 tests/tail-2/F-vs-rename.sh              |  8 +++--
 tests/tail-2/append-only.sh              |  7 ++---
 tests/tail-2/assert-2.sh                 |  5 +--
 tests/tail-2/assert.sh                   |  5 +--
 tests/tail-2/f-vs-rename.sh              |  8 +++--
 tests/tail-2/flush-initial.sh            |  8 +++--
 tests/tail-2/inotify-hash-abuse.sh       | 54 ++++++++++++++++++--------------
 tests/tail-2/inotify-hash-abuse2.sh      | 28 ++++++++++-------
 tests/tail-2/inotify-rotate-resources.sh |  2 +-
 tests/tail-2/inotify-rotate.sh           |  5 ++-
 tests/tail-2/pid.sh                      | 14 ++++-----
 tests/tail-2/pipe-f2.sh                  |  7 ++++-
 tests/tail-2/retry.sh                    |  9 ++++--
 tests/tail-2/symlink.sh                  |  7 +++--
 tests/tail-2/tail-n0f.sh                 |  6 ++--
 tests/tail-2/wait.sh                     | 20 ++++++------
 17 files changed, 133 insertions(+), 107 deletions(-)

diff --git a/tests/tail-2/F-vs-missing.sh b/tests/tail-2/F-vs-missing.sh
index 5d2cc2f..d58d8e1 100755
--- a/tests/tail-2/F-vs-missing.sh
+++ b/tests/tail-2/F-vs-missing.sh
@@ -21,10 +21,6 @@
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ tail
 
-debug='---disable-inotify'
-debug=
-tail $debug -F -s.1 missing/file > out 2>&1 & pid=$!
-
 check_tail_output()
 {
   local delay="$1"
@@ -32,33 +28,30 @@ check_tail_output()
     { sleep $delay; return 1; }
 }
 
-# Wait up to 12.7s for tail to start with diagnostic:
-# tail: cannot open 'missing/file' for reading: No such file or directory
-tail_re='cannot open' retry_delay_ check_tail_output .1 7 || fail=1
+# Speedup the non inotify case
+fastpoll='-s.1 --max-unchanged-stats=1'
 
-mkdir missing || fail=1
-(cd missing && echo x > file)
+for mode in '' '---disable-inotify'; do
+  rm -rf out missing
 
-# Wait up to 12.7s for this to appear in the output:
-# "tail: '...' has appeared;  following end of new file"
-tail_re='has appeared' retry_delay_ check_tail_output .1 7 ||
-  { echo "$0: file: unexpected delay?"; cat out; fail=1; }
+  tail $mode -F $fastpoll missing/file > out 2>&1 & pid=$!
 
-kill -HUP $pid
+  # Wait up to 12.7s for tail to start with diagnostic:
+  # tail: cannot open 'missing/file' for reading: No such file or directory
+  tail_re='cannot open' retry_delay_ check_tail_output .1 7 || fail=1
 
-cleanup()
-{
-  local delay="$1"
-  rm -rf missing ||
-    { sleep $delay; return 1; }
-}
+  mkdir missing || framework_failure_
+  (cd missing && echo x > file) || framework_failure_
+
+  # Wait up to 12.7s for this to appear in the output:
+  # "tail: '...' has appeared;  following end of new file"
+  tail_re='has appeared' retry_delay_ check_tail_output .1 7 ||
+    { echo "$0: file: unexpected delay?"; cat out; fail=1; }
+
+  kill $pid
+
+  wait $pid
+done
 
-# Try repeatedly to remove the temporary directory.
-# This is normally unnecessary, because the containing directory will
-# be removed by code from init.sh.  However, when this particular test
-# is run on an NFS-mounted volume, sometimes init.sh's cleanup code
-# fails because the directory is not yet really empty, perhaps because
-# the tail process (reading missing/file) is not yet killed.
-retry_delay_ cleanup .1 6
 
 Exit $fail
diff --git a/tests/tail-2/F-vs-rename.sh b/tests/tail-2/F-vs-rename.sh
index f95b71a..ab837f0 100755
--- a/tests/tail-2/F-vs-rename.sh
+++ b/tests/tail-2/F-vs-rename.sh
@@ -28,10 +28,14 @@ check_tail_output()
     { sleep $delay; return 1; }
 }
 
-touch a b || framework_failure_
+# Speedup the non inotify case
+fastpoll='-s.1 --max-unchanged-stats=1'
 
 for mode in '' '---disable-inotify'; do
-  tail $mode -F -s.1 a b > out 2>&1 & pid=$!
+  rm -f a b out
+  touch a b || framework_failure_
+
+  tail $mode -F $fastpoll a b > out 2>&1 & pid=$!
 
   # Wait up to 12.7s for tail to start.
   echo x > a
diff --git a/tests/tail-2/append-only.sh b/tests/tail-2/append-only.sh
index 8baba7e..9da10ae 100755
--- a/tests/tail-2/append-only.sh
+++ b/tests/tail-2/append-only.sh
@@ -32,10 +32,9 @@ if test $chattr_a_works = 0; then
 fi
 
 
-for inotify in ---disable-inotify ''; do
-  sleep 1 &
-  pid=$!
-  tail --pid=$pid -f $inotify f || fail=1
+for mode in '' '---disable-inotify'; do
+  sleep 1 & pid=$!
+  tail --pid=$pid -f $mode f || fail=1
 done
 
 chattr -a f 2>/dev/null
diff --git a/tests/tail-2/assert-2.sh b/tests/tail-2/assert-2.sh
index 2d4671b..7ae2c45 100755
--- a/tests/tail-2/assert-2.sh
+++ b/tests/tail-2/assert-2.sh
@@ -27,10 +27,7 @@ very_expensive_
 ok='ok ok ok'
 
 touch a
-tail --follow=name a foo > err 2>&1 &
-tail_pid=$!
-# Arrange for the tail process to die after 12 seconds.
-(sleep 12; kill $tail_pid) &
+timeout 12 tail --follow=name a foo > err 2>&1 &
 echo $ok > f
 echo sleeping for 7 seconds...
 sleep 7
diff --git a/tests/tail-2/assert.sh b/tests/tail-2/assert.sh
index faf7e32..f162e67 100755
--- a/tests/tail-2/assert.sh
+++ b/tests/tail-2/assert.sh
@@ -32,10 +32,7 @@ very_expensive_
 ok='ok ok ok'
 
 touch a foo
-tail --follow=name a foo > err 2>&1 &
-tail_pid=$!
-# Arrange for the tail process to die after 12 seconds.
-(sleep 12; kill $tail_pid) &
+timeout 12 tail --follow=name a foo > err 2>&1 &
 
 echo sleeping for 7 seconds...
 
diff --git a/tests/tail-2/f-vs-rename.sh b/tests/tail-2/f-vs-rename.sh
index 4bff41c..0c2eff5 100755
--- a/tests/tail-2/f-vs-rename.sh
+++ b/tests/tail-2/f-vs-rename.sh
@@ -28,10 +28,14 @@ check_tail_output()
     { sleep $delay; return 1; }
 }
 
-touch a || framework_failure_
+# Speedup the non inotify case
+fastpoll='-s.1 --max-unchanged-stats=1'
 
 for mode in '' '---disable-inotify'; do
-  tail $mode -f -s.1 a > out 2>&1 & pid=$!
+  rm -f a out
+  touch a || framework_failure_
+
+  tail $mode $fastpoll -f a > out 2>&1 & pid=$!
 
   # Wait up to 12.7s for tail to start.
   echo x > a
diff --git a/tests/tail-2/flush-initial.sh b/tests/tail-2/flush-initial.sh
index 1c8d6b0..ffe0890 100755
--- a/tests/tail-2/flush-initial.sh
+++ b/tests/tail-2/flush-initial.sh
@@ -19,11 +19,13 @@
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ tail
 
+# Speedup the non inotify case
+fastpoll='-s.1 --max-unchanged-stats=1'
+
 echo line > in || fail=1
 # Output should be buffered since we're writing to file
 # so we're depending on the flush to write out
-tail -f in > out &
-tail_pid=$!
+tail $fastpoll -f in > out & tail_pid=$!
 
 # Wait for 3.1s for the file to be flushed.
 tail_flush()
@@ -37,4 +39,6 @@ retry_delay_ tail_flush .1 5 || fail=1
 
 kill $tail_pid
 
+wait $tail_pid
+
 Exit $fail
diff --git a/tests/tail-2/inotify-hash-abuse.sh 
b/tests/tail-2/inotify-hash-abuse.sh
index b819b97..76d3c51 100755
--- a/tests/tail-2/inotify-hash-abuse.sh
+++ b/tests/tail-2/inotify-hash-abuse.sh
@@ -23,10 +23,6 @@ print_ver_ tail
 n=9
 seq $n | xargs touch || framework_failure_
 
-debug='---disable-inotify'
-debug=
-tail $debug -s.1 -qF $(seq $n) > out 2>&1 & pid=$!
-
 check_tail_output()
 {
   local delay="$1"
@@ -34,30 +30,42 @@ check_tail_output()
     { sleep $delay; return 1; }
 }
 
-# Wait up to 12.7s for tail to start
-echo x > $n
-tail_re='^x$' retry_delay_ check_tail_output .1 7 || fail=1
+# Speedup the non inotify case
+fastpoll='-s.1 --max-unchanged-stats=1'
 
-mv 1 f || fail=1
+for mode in '' '---disable-inotify'; do
+  rm -f out
 
-# Wait 12.7s for this diagnostic:
-# tail: '1' has become inaccessible: No such file or directory
-tail_re='inaccessible' retry_delay_ check_tail_output .1 7 || fail=1
+  tail $mode $fastpoll -qF $(seq $n) > out 2>&1 & pid=$!
 
-# Trigger the bug.  Before the fix, this would provoke the abort.
-echo a > 1 || fail=1
+  # Wait up to 12.7s for tail to start
+  echo x > $n
+  tail_re='^x$' retry_delay_ check_tail_output .1 7 ||
+    { cat out; fail=1; }
 
-# Wait up to 2s for the buggy tail to die,
-# or for the "tail: '1' has appeared;  following end of new file" output
-for i in $(seq 10); do
-  kill -0 $pid || break
-  grep 'has appeared;' out > /dev/null && break
-  sleep .2
-done
+  mv 1 f || framework_failure_
+
+  # Wait 12.7s for this diagnostic:
+  # tail: '1' has become inaccessible: No such file or directory
+  tail_re='inaccessible' retry_delay_ check_tail_output .1 7 ||
+    { cat out; fail=1; }
+
+  # Trigger the bug.  Before the fix, this would provoke the abort.
+  echo a > 1 || framework_failure_
 
-# Kill the working tail, or fail if it has already aborted
-kill $pid || fail=1
+  # Wait up to 2s for the buggy tail to die,
+  # or for the "tail: '1' has appeared;  following end of new file" output
+  for i in $(seq 10); do
+    kill -0 $pid || break
+    grep 'has appeared;' out > /dev/null && break
+    sleep .2
+  done
+
+  # Kill the working tail, or fail if it has already aborted
+  kill $pid || fail=1
+
+  wait $pid
+done
 
-cat out
 
 Exit $fail
diff --git a/tests/tail-2/inotify-hash-abuse2.sh 
b/tests/tail-2/inotify-hash-abuse2.sh
index 241f26e..b054237 100755
--- a/tests/tail-2/inotify-hash-abuse2.sh
+++ b/tests/tail-2/inotify-hash-abuse2.sh
@@ -20,20 +20,24 @@
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ tail
 
-touch f || framework_failure_
+# Speedup the non inotify case
+fastpoll='-s.1 --max-unchanged-stats=1'
 
-debug='---disable-inotify -s .001'
-debug=
-tail $debug -F f & pid=$!
-cleanup_() { kill $pid; }
+for mode in '' '---disable-inotify'; do
+  touch f || framework_failure_
 
-for i in $(seq 200); do
-  kill -0 $pid || break;
-  mv f g
-  touch f
-done
+  tail $mode $fastpoll -F f & pid=$!
+
+  for i in $(seq 200); do
+    kill -0 $pid || break;
+    mv f g
+    touch f
+  done
 
-# Kill the working tail, or fail if it has already aborted
-kill $pid || fail=1
+  # Kill the working tail, or fail if it has already aborted
+  kill $pid || fail=1
+
+  wait $pid
+done
 
 Exit $fail
diff --git a/tests/tail-2/inotify-rotate-resources.sh 
b/tests/tail-2/inotify-rotate-resources.sh
index a43f176..ab51b3b 100755
--- a/tests/tail-2/inotify-rotate-resources.sh
+++ b/tests/tail-2/inotify-rotate-resources.sh
@@ -91,6 +91,6 @@ done
 
 test "$reverted_to_polling_" = 1 && skip_ 'inotify resources already depleted'
 kill $pid
-wait
+wait $pid
 
 Exit $fail
diff --git a/tests/tail-2/inotify-rotate.sh b/tests/tail-2/inotify-rotate.sh
index 64724f9..5dbae19 100755
--- a/tests/tail-2/inotify-rotate.sh
+++ b/tests/tail-2/inotify-rotate.sh
@@ -40,6 +40,9 @@ cleanup_fail()
   fail=1
 }
 
+# Speedup the non inotify case
+fastpoll='-s.1 --max-unchanged-stats=1'
+
 # Perform at least this many iterations, because on multi-core systems
 # the offending sequence of events can be surprisingly uncommon.
 # See: http://lists.gnu.org/archive/html/bug-coreutils/2009-11/msg00213.html
@@ -51,7 +54,7 @@ for i in $(seq 50); do
     # and a lot of disk activity, even 20 seconds is insufficient, which
     # leads to this timeout killing tail before the "ok" is written below.
     >k && >x || framework_failure_ failed to initialize files
-    timeout 60 tail -s.1 --max-unchanged-stats=1 -F k > out 2>&1 &
+    timeout 60 tail $fastpoll -F k > out 2>&1 &
     pid=$!
 
     echo 'tailed' > k;
diff --git a/tests/tail-2/pid.sh b/tests/tail-2/pid.sh
index e6b75a5..7a49867 100755
--- a/tests/tail-2/pid.sh
+++ b/tests/tail-2/pid.sh
@@ -23,28 +23,28 @@ getlimits_
 touch empty here || framework_failure_
 
 
-for inotify in ---disable-inotify ''; do
+for mode in '' '---disable-inotify'; do
   # Use tail itself to create a background process to monitor,
   # which will auto exit when "here" is removed.
-  tail -f $inotify here &
-  bg_pid=$!
+  tail -f $mode here & pid=$!
 
   # Ensure that tail --pid=PID does not exit when PID is alive.
-  timeout 1 tail -f -s.1 --pid=$bg_pid $inotify here
+  timeout 1 tail -f -s.1 --pid=$pid $mode here
   test $? = 124 || fail=1
 
   # Cleanup background process
-  kill $bg_pid
+  kill $pid
+  wait $pid
 
   # Ensure that tail --pid=PID exits with success status when PID is dead.
   # Use an unlikely-to-be-live PID
-  timeout 10 tail -f -s.1 --pid=$PID_T_MAX $inotify empty
+  timeout 10 tail -f -s.1 --pid=$PID_T_MAX $mode empty
   ret=$?
   test $ret = 124 && skip_ "pid $PID_T_MAX present or tail too slow"
   test $ret = 0 || fail=1
 
   # Ensure tail doesn't wait for data when PID is dead
-  timeout 10 tail -f -s10 --pid=$PID_T_MAX $inotify empty
+  timeout 10 tail -f -s10 --pid=$PID_T_MAX $mode empty
   test $? = 124 && fail=1
 done
 
diff --git a/tests/tail-2/pipe-f2.sh b/tests/tail-2/pipe-f2.sh
index a40d552..4d5fe51 100755
--- a/tests/tail-2/pipe-f2.sh
+++ b/tests/tail-2/pipe-f2.sh
@@ -24,7 +24,10 @@ mkfifo_or_skip_ fifo
 echo 1 > fifo &
 echo 1 > exp || framework_failure_
 
-timeout 10 tail -f fifo > out & pid=$!
+# Speedup the non inotify case
+fastpoll='-s.1 --max-unchanged-stats=1'
+
+timeout 10 tail $fastpoll -f fifo > out & pid=$!
 
 check_tail_output()
 {
@@ -40,4 +43,6 @@ compare exp out || fail=1
 # Kill the still-running tail, or fail if it's gone.
 kill $pid || fail=1
 
+wait $pid
+
 Exit $fail
diff --git a/tests/tail-2/retry.sh b/tests/tail-2/retry.sh
index 97bd6d3..a1167fc 100755
--- a/tests/tail-2/retry.sh
+++ b/tests/tail-2/retry.sh
@@ -36,6 +36,9 @@ wait4lines_ ()
   [ "$(countlines_)" -ge "$elc" ] || { sleep $delay; return 1; }
 }
 
+# Speedup the non inotify case
+fastpoll='-s.1 --max-unchanged-stats=1'
+
 # === Test:
 # Retry without --follow results in a warning.
 touch file
@@ -53,7 +56,7 @@ grep -F 'tail: warning: --retry ignored' out || fail=1
 # Ensure that "tail --retry --follow=name" waits for the file to appear.
 # Clear 'out' so that we can check its contents without races
 >out                            || framework_failure_
-timeout 10 tail -s.1 --follow=name --retry missing >out 2>&1 & pid=$!
+timeout 10 tail $fastpoll --follow=name --retry missing >out 2>&1 & pid=$!
 retry_delay_ wait4lines_ .1 6 1 || fail=1  # Wait for "cannot open" error.
 echo "X" > missing              || fail=1
 retry_delay_ wait4lines_ .1 6 3 || fail=1  # Wait for the expected output.
@@ -69,7 +72,7 @@ rm -f missing out          || framework_failure_
 # === Test:
 # Ensure that "tail --retry --follow=descriptor" waits for the file to appear.
 # tail-8.21 failed at this (since the implementation of the inotify support).
-timeout 10 tail -s.1 --follow=descriptor --retry missing >out 2>&1 & pid=$!
+timeout 10 tail $fastpoll --follow=descriptor --retry missing >out 2>&1 & 
pid=$!
 retry_delay_ wait4lines_ .1 6 2 || fail=1  # Wait for "cannot open" error.
 echo "X" > missing              || fail=1
 retry_delay_ wait4lines_ .1 6 4 || fail=1  # Wait for the expected output.
@@ -87,7 +90,7 @@ rm -f missing out          || framework_failure_
 # === Test:
 # Ensure that tail --follow=descriptor --retry exits when the file appears
 # untailable. Expect exit status 1.
-timeout 10 tail -s.1 --follow=descriptor --retry missing >out 2>&1 & pid=$!
+timeout 10 tail $fastpoll --follow=descriptor --retry missing >out 2>&1 & 
pid=$!
 retry_delay_ wait4lines_ .1 6 2 || fail=1  # Wait for "cannot open" error.
 mkdir missing                   || fail=1  # Create untailable 'missing'.
 retry_delay_ wait4lines_ .1 6 4 || fail=1  # Wait for the expected output.
diff --git a/tests/tail-2/symlink.sh b/tests/tail-2/symlink.sh
index 274df95..a357b34 100755
--- a/tests/tail-2/symlink.sh
+++ b/tests/tail-2/symlink.sh
@@ -36,12 +36,15 @@ wait4lines_ ()
   [ "$(countlines_)" -ge "$elc" ] || { sleep $delay; return 1; }
 }
 
+# speedup non inotify case
+fastpoll='-s.1 --max-unchanged-stats=1'
+
 # Ensure changing targets of cli specified symlinks are handled.
 # Prior to v8.22, inotify would fail to recognize changes in the targets.
 # Clear 'out' so that we can check its contents without races.
 >out                            || framework_failure_
 ln -nsf target symlink          || framework_failure_
-timeout 10 tail -s.1 -F symlink >out 2>&1 & pid=$!
+timeout 10 tail $fastpoll -F symlink >out 2>&1 & pid=$!
 retry_delay_ wait4lines_ .1 6 1 || fail=1  # Wait for "cannot open..."
 echo "X" > target               || fail=1
 retry_delay_ wait4lines_ .1 6 3 || fail=1  # Wait for the expected output.
@@ -60,7 +63,7 @@ rm -f target out           || framework_failure_
 >out                            || framework_failure_
 echo "X1" > target1             || framework_failure_
 ln -nsf target1 symlink         || framework_failure_
-timeout 10 tail -s.1 -F symlink >out 2>&1 & pid=$!
+timeout 10 tail $fastpoll -F symlink >out 2>&1 & pid=$!
 retry_delay_ wait4lines_ .1 6 1 || fail=1  # Wait for the expected output.
 ln -nsf target2 symlink         || framework_failure_
 retry_delay_ wait4lines_ .1 6 2 || fail=1  # Wait for "become inaccess..."
diff --git a/tests/tail-2/tail-n0f.sh b/tests/tail-2/tail-n0f.sh
index 26a7b26..f713a12 100755
--- a/tests/tail-2/tail-n0f.sh
+++ b/tests/tail-2/tail-n0f.sh
@@ -35,11 +35,10 @@ chmod 0 unreadable || framework_failure_
 tail -c0 unreadable || fail=1
 tail -n0 unreadable || fail=1
 
-for inotify in ---disable-inotify ''; do
+for mode in '' '---disable-inotify'; do
   for file in empty nonempty; do
     for c_or_n in c n; do
-      tail --sleep=4 -${c_or_n} 0 -f $inotify $file &
-      pid=$!
+      tail --sleep=4 -${c_or_n} 0 -f $mode $file & pid=$!
       tail_sleeping()
       {
         local delay="$1"; sleep $delay
@@ -53,6 +52,7 @@ for inotify in ---disable-inotify ''; do
       retry_delay_ tail_sleeping .1 4 ||
         { echo $0: process in unexpected state: $state >&2; fail=1; }
       kill $pid
+      wait $pid
     done
   done
 done
diff --git a/tests/tail-2/wait.sh b/tests/tail-2/wait.sh
index 839fcf6..0640e60 100755
--- a/tests/tail-2/wait.sh
+++ b/tests/tail-2/wait.sh
@@ -23,30 +23,32 @@ print_ver_ tail
 touch here || framework_failure_
 { touch unreadable && chmod a-r unreadable; } || framework_failure_
 
+# speedup non inotify case
+fastpoll='-s.1 --max-unchanged-stats=1'
 
-for inotify in ---disable-inotify ''; do
-  timeout 10 tail -s0.1 -f $inotify not_here
+for mode in '' '---disable-inotify'; do
+  timeout 10 tail $fastpoll -f $mode not_here
   test $? = 124 && fail=1
 
   if test ! -r unreadable; then # can't test this when root
-    timeout 10 tail -s0.1 -f $inotify unreadable
+    timeout 10 tail $fastpoll -f $mode unreadable
     test $? = 124 && fail=1
   fi
 
-  timeout 1 tail -s0.1 -f $inotify here 2>tail.err
+  timeout 1 tail $fastpoll -f $mode here 2>tail.err
   test $? = 124 || fail=1
 
   # 'tail -F' must wait in any case.
 
-  timeout 1 tail -s0.1 -F $inotify here 2>>tail.err
+  timeout 1 tail $fastpoll -F $mode here 2>>tail.err
   test $? = 124 || fail=1
 
   if test ! -r unreadable; then # can't test this when root
-    timeout 1 tail -s0.1 -F $inotify unreadable
+    timeout 1 tail $fastpoll -F $mode unreadable
     test $? = 124 || fail=1
   fi
 
-  timeout 1 tail -s0.1 -F $inotify not_here
+  timeout 1 tail $fastpoll -F $mode not_here
   test $? = 124 || fail=1
 
   grep -Ev 'inotify (resources exhausted|cannot be used)' tail.err > x
@@ -59,8 +61,7 @@ for inotify in ---disable-inotify ''; do
     local delay="$1"
 
     touch k || framework_failure_
-    tail -s.1 --max-unchanged-stats=2 -F $inotify k > tail.out &
-    pid=$!
+    tail $fastpoll -F $mode k > tail.out & pid=$!
     sleep $delay
     mv k l
     sleep $delay
@@ -70,6 +71,7 @@ for inotify in ---disable-inotify ''; do
     echo NO >> l
     sleep $delay
     kill $pid
+    wait $pid
     rm -f k l
 
     test ! -s tail.out
-- 
2.3.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]