diff --git a/tests/tail-2/inotify-dir-recreate.sh b/tests/tail-2/inotify-dir-recreate.sh index 469876b98..5d629d8cd 100755 --- a/tests/tail-2/inotify-dir-recreate.sh +++ b/tests/tail-2/inotify-dir-recreate.sh @@ -25,7 +25,12 @@ grep '^#define HAVE_INOTIFY 1' "$CONFIG_HEADER" >/dev/null && is_local_dir_ . \ || skip_ 'inotify is not supported' # Terminate any background tail process -cleanup_() { kill $pid 2>/dev/null && wait $pid; } +cleanup_() { + kill $pid 2>/dev/null \ + || return + wait $pid + echo "wait status (PID=$pid): $?" +} cleanup_fail_ () { @@ -39,7 +44,7 @@ cleanup_fail_ () check_tail_output_ () { local delay="$1" - grep $check_re $check_f > /dev/null || + grep $check_re $check_f || { sleep $delay ; return 1; } } @@ -54,7 +59,8 @@ grep_timeout_ () mkdir dir && echo 'inotify' > dir/file || framework_failure_ #tail must print content of the file to stdout, verify -timeout 60 tail --pid=$$ -F dir/file >out 2>&1 & pid=$! +timeout 60 \ + tail --pid=$$ -F -s1 --max-unchanged-stats=2 dir/file >out 2>&1 & pid=$! grep_timeout_ 'inotify' 'out' || { cleanup_fail_ 'file to be tailed does not exist'; }