diff options
Diffstat (limited to 'tests/tail-2/flush-initial.sh')
-rwxr-xr-x | tests/tail-2/flush-initial.sh | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/tests/tail-2/flush-initial.sh b/tests/tail-2/flush-initial.sh index fd14eae9..a25bbeb1 100755 --- a/tests/tail-2/flush-initial.sh +++ b/tests/tail-2/flush-initial.sh @@ -1,7 +1,7 @@ #!/bin/sh # inotify-based tail -f didn't flush its initial output before blocking -# 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 @@ -19,13 +19,18 @@ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src print_ver_ tail -echo line > in || fail=1 +# Speedup the non inotify case +fastpoll='-s.1 --max-unchanged-stats=1' + +# Terminate any background tail process +cleanup_() { kill $pid 2>/dev/null && wait $pid; } + +echo line > in || framework_failure_ # 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 & pid=$! -# Wait for 1.5s for the file to be flushed. +# Wait for 3.1s for the file to be flushed. tail_flush() { local delay="$1" @@ -35,6 +40,6 @@ tail_flush() } retry_delay_ tail_flush .1 5 || fail=1 -kill $tail_pid +cleanup_ Exit $fail |