Document not_eol and remove mention of regex.c.
[gnulib.git] / tests / test-closein.sh
1 #!/bin/sh
2
3 tmpfiles=
4 trap 'rm -fr $tmpfiles' 1 2 3 15
5
6 p=t-closein-
7 tmpfiles="${p}in.tmp ${p}xout.tmp ${p}out1.tmp ${p}out2.tmp"
8
9 echo Hello world > ${p}in.tmp
10 echo world > ${p}xout.tmp
11
12 # Test with seekable stdin; followon process must see remaining data
13 (./test-closein${EXEEXT}; cat) < ${p}in.tmp > ${p}out1.tmp || exit 1
14 cmp ${p}out1.tmp ${p}in.tmp || exit 1
15
16 (./test-closein${EXEEXT} consume; cat) < ${p}in.tmp > ${p}out2.tmp || exit 1
17 cmp ${p}out2.tmp ${p}xout.tmp || exit 1
18
19 # Test for lack of error on pipe.  Ignore any EPIPE failures from cat.
20 cat ${p}in.tmp 2>/dev/null | ./test-closein${EXEEXT} || exit 1
21
22 cat ${p}in.tmp 2>/dev/null | ./test-closein${EXEEXT} consume || exit 1
23
24 # Test for lack of error when nothing is read
25 ./test-closein${EXEEXT} </dev/null || exit 1
26
27 ./test-closein${EXEEXT} <&- || exit 1
28
29 # Test for no error when EOF is read early
30 ./test-closein${EXEEXT} consume </dev/null || exit 1
31
32 # Test for error when read fails because no file available
33 ./test-closein${EXEEXT} consume close <&- 2>/dev/null && exit 1
34
35 # Cleanup
36 rm -fr $tmpfiles
37
38 exit 0