~ubuntu-branches/ubuntu/utopic/coreutils/utopic-proposed

« back to all changes in this revision

Viewing changes to tests/tail-2/inotify-race

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-11-28 03:03:42 UTC
  • mfrom: (8.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20121128030342-21zanj8354gas5gr
Tags: 8.20-3ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Make 'uname -i -p' return the real processor/hardware, instead of
    unknown.
  - Build-depend on gettext:any instead of on gettext, so that apt-get can
    properly resolve build-dependencies on the tool when cross-building.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
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.
7
 
 
8
 
# Copyright (C) 2009-2011 Free Software Foundation, Inc.
9
 
 
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.
14
 
 
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.
19
 
 
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/>.
22
 
 
23
 
. "${srcdir=.}/init.sh"; path_prepend_ ../src
24
 
print_ver_ tail
25
 
 
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.
29
 
very_expensive_
30
 
 
31
 
touch file || framework_failure_
32
 
touch tail.out || framework_failure_
33
 
 
34
 
( timeout 10s gdb --version ) > gdb.out 2>&1
35
 
case $(cat gdb.out) in
36
 
    *'GNU gdb'*) ;;
37
 
    *) skip_ "can't run gdb";;
38
 
esac
39
 
 
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
47
 
 
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"; }
52
 
 
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 &
63
 
pid=$!
64
 
 
65
 
tail --pid=$pid -f tail.out | (read; kill $pid)
66
 
 
67
 
test -s tail.out || fail=1
68
 
 
69
 
Exit $fail