diff options
author | Eric Blake <eblake@redhat.com> | 2011-05-24 17:16:00 -0600 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2011-05-24 17:22:51 -0600 |
commit | d1608870ede6159bbcc542e8142c15d729c0b66c (patch) | |
tree | 4ff4adbc7ff76ec20eaed6730e933198e93ffdd3 /tests | |
parent | 6ff1e78673e4161168b8c657eed78e86c9cc29c7 (diff) | |
download | gnulib-d1608870ede6159bbcc542e8142c15d729c0b66c.tar.gz |
closein-tests: convert to init.sh
* modules/closein-tests (Files): Add init.sh
* tests/test-closein.sh Use it.
Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test-closein.sh | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/tests/test-closein.sh b/tests/test-closein.sh index a75929a204..27b792969c 100755 --- a/tests/test-closein.sh +++ b/tests/test-closein.sh @@ -1,38 +1,32 @@ #!/bin/sh +: ${srcdir=.} +. "$srcdir/init.sh"; path_prepend_ . -tmpfiles= -trap 'rm -fr $tmpfiles' 1 2 3 15 - -p=t-closein- -tmpfiles="${p}in.tmp ${p}xout.tmp ${p}out1.tmp ${p}out2.tmp" - -echo Hello world > ${p}in.tmp -echo world > ${p}xout.tmp +echo Hello world > in.tmp +echo world > xout.tmp +fail=0 # Test with seekable stdin; followon process must see remaining data -(./test-closein${EXEEXT}; cat) < ${p}in.tmp > ${p}out1.tmp || exit 1 -cmp ${p}out1.tmp ${p}in.tmp || exit 1 +(test-closein; cat) < in.tmp > out1.tmp || fail=1 +cmp out1.tmp in.tmp || fail=1 -(./test-closein${EXEEXT} consume; cat) < ${p}in.tmp > ${p}out2.tmp || exit 1 -cmp ${p}out2.tmp ${p}xout.tmp || exit 1 +(test-closein consume; cat) < in.tmp > out2.tmp || fail=1 +cmp out2.tmp xout.tmp || fail=1 # Test for lack of error on pipe. Ignore any EPIPE failures from cat. -cat ${p}in.tmp 2>/dev/null | ./test-closein${EXEEXT} || exit 1 +cat in.tmp 2>/dev/null | test-closein || fail=1 -cat ${p}in.tmp 2>/dev/null | ./test-closein${EXEEXT} consume || exit 1 +cat in.tmp 2>/dev/null | test-closein consume || fail=1 # Test for lack of error when nothing is read -./test-closein${EXEEXT} </dev/null || exit 1 +test-closein </dev/null || fail=1 -./test-closein${EXEEXT} <&- || exit 1 +test-closein <&- || fail=1 # Test for no error when EOF is read early -./test-closein${EXEEXT} consume </dev/null || exit 1 +test-closein consume </dev/null || fail=1 # Test for error when read fails because no file available -./test-closein${EXEEXT} consume close <&- 2>/dev/null && exit 1 - -# Cleanup -rm -fr $tmpfiles +test-closein consume close <&- 2>/dev/null && fail=1 -exit 0 +Exit $fail |