2
# Make sure that 'tail -f' returns immediately if a file doesn't exist
3
# while 'tail -F' waits for it to appear.
5
# Copyright (C) 2003-2012 Free Software Foundation, Inc.
7
# This program is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation, either version 3 of the License, or
10
# (at your option) any later version.
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
17
# You should have received a copy of the GNU General Public License
18
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
23
touch here || framework_failure_
24
{ touch unreadable && chmod a-r unreadable; } || framework_failure_
27
for inotify in ---disable-inotify ''; do
28
timeout 10 tail -s0.1 -f $inotify not_here
29
test $? = 124 && fail=1
31
if test ! -r unreadable; then # can't test this when root
32
timeout 10 tail -s0.1 -f $inotify unreadable
33
test $? = 124 && fail=1
36
timeout 1 tail -s0.1 -f $inotify here 2>tail.err
37
test $? = 124 || fail=1
39
# 'tail -F' must wait in any case.
41
timeout 1 tail -s0.1 -F $inotify here 2>>tail.err
42
test $? = 124 || fail=1
44
if test ! -r unreadable; then # can't test this when root
45
timeout 1 tail -s0.1 -F $inotify unreadable
46
test $? = 124 || fail=1
49
timeout 1 tail -s0.1 -F $inotify not_here
50
test $? = 124 || fail=1
52
grep -Ev 'inotify (resources exhausted|cannot be used)' tail.err > x
54
test -s tail.err && fail=1
61
touch k || framework_failure_
62
tail -s.1 --max-unchanged-stats=2 -F $inotify k > tail.out &
77
retry_delay_ tail_F .1 4 || fail=1