Mercurial > gnulib
annotate tests/test-closein.sh @ 40196:e63f5d3edab5
relocatable-prog: Update documentation.
* doc/relocatable-maint.texi (Supporting Relocation): Update to match
the recent changes.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 24 Feb 2019 01:49:15 +0100 |
parents | a712776b11ce |
children | 8c1a17df67e0 |
rev | line source |
---|---|
8730 | 1 #!/bin/sh |
14822
a29ad2af0c29
closein-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
11256
diff
changeset
|
2 : ${srcdir=.} |
a29ad2af0c29
closein-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
11256
diff
changeset
|
3 . "$srcdir/init.sh"; path_prepend_ . |
8730 | 4 |
14822
a29ad2af0c29
closein-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
11256
diff
changeset
|
5 echo Hello world > in.tmp |
a29ad2af0c29
closein-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
11256
diff
changeset
|
6 echo world > xout.tmp |
8730 | 7 |
14822
a29ad2af0c29
closein-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
11256
diff
changeset
|
8 fail=0 |
16358 | 9 # Test with seekable stdin; follow-on process must see remaining data |
14822
a29ad2af0c29
closein-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
11256
diff
changeset
|
10 (test-closein; cat) < in.tmp > out1.tmp || fail=1 |
a29ad2af0c29
closein-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
11256
diff
changeset
|
11 cmp out1.tmp in.tmp || fail=1 |
8730 | 12 |
14822
a29ad2af0c29
closein-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
11256
diff
changeset
|
13 (test-closein consume; cat) < in.tmp > out2.tmp || fail=1 |
a29ad2af0c29
closein-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
11256
diff
changeset
|
14 cmp out2.tmp xout.tmp || fail=1 |
8730 | 15 |
11256
e12ffbb3ba4b
test-closein: silence test under Darwin
Eric Blake <ebb9@byu.net>
parents:
9230
diff
changeset
|
16 # Test for lack of error on pipe. Ignore any EPIPE failures from cat. |
14822
a29ad2af0c29
closein-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
11256
diff
changeset
|
17 cat in.tmp 2>/dev/null | test-closein || fail=1 |
8730 | 18 |
14822
a29ad2af0c29
closein-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
11256
diff
changeset
|
19 cat in.tmp 2>/dev/null | test-closein consume || fail=1 |
8730 | 20 |
21 # Test for lack of error when nothing is read | |
14822
a29ad2af0c29
closein-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
11256
diff
changeset
|
22 test-closein </dev/null || fail=1 |
8730 | 23 |
14822
a29ad2af0c29
closein-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
11256
diff
changeset
|
24 test-closein <&- || fail=1 |
8730 | 25 |
26 # Test for no error when EOF is read early | |
14822
a29ad2af0c29
closein-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
11256
diff
changeset
|
27 test-closein consume </dev/null || fail=1 |
8730 | 28 |
29 # Test for error when read fails because no file available | |
14822
a29ad2af0c29
closein-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
11256
diff
changeset
|
30 test-closein consume close <&- 2>/dev/null && fail=1 |
8730 | 31 |
14822
a29ad2af0c29
closein-tests: convert to init.sh
Eric Blake <eblake@redhat.com>
parents:
11256
diff
changeset
|
32 Exit $fail |