2 # Ensure that tail does not ignore data that is appended to a tailed-forever
3 # file between tail's initial read-to-EOF, and when the inotify watches
4 # are established in tail_forever_inotify. That data could be ignored
5 # indefinitely if no *other* data is appended, but it would be printed as
6 # soon as any additional appended data is detected.
8 # Copyright (C) 2009-2011 Free Software Foundation, Inc.
10 # This program is free software: you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation, either version 3 of the License, or
13 # (at your option) any later version.
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program. If not, see <http://www.gnu.org/licenses/>.
23 .
"${srcdir=.}/init.sh"; path_prepend_ ..
/src
26 # Don't run this test by default because sometimes it's skipped as noted below.
27 # Also gdb has a bug in Debian's gdb-6.8-3 at least that causes it to not
28 # cleanup and exit correctly when it receives a SIGTERM, thus hanging the test.
31 touch file || framework_failure_
32 touch tail.out || framework_failure_
34 ( timeout
10s gdb
--version ) > gdb.out
2>&1
35 case $
(cat gdb.out
) in
37 *) skip_
"can't run gdb";;
40 # See if gdb works and
41 # tail_forever_inotify is compiled and not inlined
42 timeout
10s gdb
-nx --batch-silent \
43 --eval-command='break tail_forever_inotify' \
44 --eval-command='run -f file' \
45 --eval-command='quit' \
46 tail < /dev
/null
> gdb.out
2>&1
48 # FIXME: The above is seen to _intermittently_ fail with:
49 # warning: .dynamic section for "/lib/libc.so.6" is not at the expected address
50 # warning: difference appears to be caused by prelink, adjusting expectations
51 test -s gdb.out
&& { cat gdb.out
; skip_
"can't set breakpoints in tail"; }
53 # Run "tail -f file", stopping to append a line just before
54 # inotify initialization, and then continue. Before the fix,
55 # that just-appended line would never be output.
56 timeout
10s gdb
-nx --batch-silent \
57 --eval-command='break tail_forever_inotify' \
58 --eval-command='run -f file >> tail.out' \
59 --eval-command="shell echo never-seen-with-tail-7.5 >> file" \
60 --eval-command='continue' \
61 --eval-command='quit' \
62 tail < /dev
/null
> /dev
/null
2>&1 &
65 tail --pid=$pid -f tail.out |
(read; kill $pid)
67 test -s tail.out || fail
=1