*** empty log message ***
[coreutils.git] / tests / tail-2 / fflush
blobd4fc01e25364cef15c17dc04e01c807a40953b00
1 #!/bin/sh
2 # This test would fail on solaris2.7 with tail from pre-1.22k textutils.
3 # The problem was that using the solaris2.7 setvbuf function to turn off
4 # buffering doesn't flush stdout.
6 # FIXME: actually, I couldn't find a way to write the test (without resorting
7 # to use of expect) so that it would provoke the failure on solaris2.7.
8 # To exercise the bug, cat's stdout seems to have to be directed
9 # to a terminal.
11 if test "$VERBOSE" = yes; then
12 set -x
13 tail --version
16 tmp=tail-flush.$$
17 pwd=`pwd`
18 trap "cd $pwd; rm -rf $tmp" 0 1 2 3 15
20 test_failure=0
21 mkdir $tmp || test_failure=1
22 cd $tmp || test_failure=1
24 if test $test_failure = 1; then
25 echo 'failure in testing framework'
26 exit 1
29 echo fubar > in
30 tail -f in | cat > out &
31 pid=$!
32 sleep 1
33 kill $pid
35 fail=0
36 test "`cat out`" = fubar || fail=1
38 exit $fail