2 # Make sure that `tail -n0 -f' and `tail -c0 -f' sleep
3 # rather than doing what amounted to a busy-wait.
4 # This bug was fixed for 5.0.91
5 # It skips the test if your system lacks a /proc/$pid/status
6 # file, or if its contents don't look right.
8 if test "$VERBOSE" = yes; then
16 grep '^State:[ ]*[S]' /proc
/$pid/status
> /dev
/null
2>&1 || \
18 echo "$0:/proc/$pid/status: missing or 'different': skipping this test" 1>&2
24 t0
=`echo "$0"|sed 's,.*/,,'`.tmp
; tmp
=$t0/$$
25 trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
26 trap '(exit $?); exit $?' 1 2 13 15
29 mkdir
-p $tmp || framework_failure
=1
30 cd $tmp || framework_failure
=1
31 touch empty || framework_failure
=1
32 echo anything
> nonempty || framework_failure
=1
34 if test $framework_failure = 1; then
35 echo "$0: failure in testing framework" 1>&2
41 for file in empty nonempty
; do
43 tail --sleep=4 -${c_or_n} 0 -f $file &
46 set _
`sed -n '/^State:[ ]*\([^ ]\)/s//\1/p' /proc/$pid/status`
47 shift # Remove the leading `_'.
51 *) echo $0: process
in unexpected state
: $state 1>&2; fail
=1 ;;
57 (exit $fail); exit $fail