usleep tests: Avoid failure due to known Cygwin 3.5.3 bug.
[gnulib.git] / tests / test-closein.sh
blob7d0fb919dc6da898f89ad552b86c38eee1e42b8f
1 #!/bin/sh
2 : "${srcdir=.}"
3 . "$srcdir/init.sh"; path_prepend_ .
5 echo Hello world > in.tmp
6 echo world > xout.tmp
8 fail=0
9 # Test with seekable stdin; follow-on process must see remaining data
10 (${CHECKER} test-closein; cat) < in.tmp > out1.tmp || fail=1
11 cmp out1.tmp in.tmp || fail=1
13 (${CHECKER} test-closein consume; cat) < in.tmp > out2.tmp || fail=1
14 cmp out2.tmp xout.tmp || fail=1
16 # Test for lack of error on pipe. Ignore any EPIPE failures from cat.
17 cat in.tmp 2>/dev/null | ${CHECKER} test-closein || fail=1
19 cat in.tmp 2>/dev/null | ${CHECKER} test-closein consume || fail=1
21 # Test for lack of error when nothing is read
22 ${CHECKER} test-closein </dev/null || fail=1
24 ${CHECKER} test-closein <&- || fail=1
26 # Test for no error when EOF is read early
27 ${CHECKER} test-closein consume </dev/null || fail=1
29 # Test for error when read fails because no file available
30 ${CHECKER} test-closein consume close <&- 2>/dev/null && fail=1
32 Exit $fail