summaryrefslogtreecommitdiff
path: root/tests/tail-2/pipe-f2.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tail-2/pipe-f2.sh')
-rwxr-xr-xtests/tail-2/pipe-f2.sh18
1 files changed, 13 insertions, 5 deletions
diff --git a/tests/tail-2/pipe-f2.sh b/tests/tail-2/pipe-f2.sh
index 13ccd0b3..71a081c3 100755
--- a/tests/tail-2/pipe-f2.sh
+++ b/tests/tail-2/pipe-f2.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# Ensure that "tail -f fifo" tails indefinitely.
-# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2009-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
@@ -24,7 +24,13 @@ mkfifo_or_skip_ fifo
echo 1 > fifo &
echo 1 > exp || framework_failure_
-timeout 10 tail -f fifo > out & pid=$!
+# Terminate any background tail process
+cleanup_() { kill $pid 2>/dev/null && wait $pid; }
+
+# Speedup the non inotify case
+fastpoll='-s.1 --max-unchanged-stats=1'
+
+timeout 10 tail $fastpoll -f fifo > out & pid=$!
check_tail_output()
{
@@ -32,12 +38,14 @@ check_tail_output()
test -s out || { sleep $n_sec; return 1; }
}
-# Wait 6.3s for tail to write something.
+# Wait 12.7s for tail to write something.
retry_delay_ check_tail_output .1 7 || fail=1
compare exp out || fail=1
-# Kill the still-running tail, or fail if it's gone.
-kill $pid || fail=1
+# Ensure tail is still running
+kill -0 $pid || fail=1
+
+cleanup_
Exit $fail