changeset 13251:700012efeb01

tests: be robust to ignored SIGPIPE Noticed during a libvirt test run with trap '' SIGPIPE. * tests/test-select-in.sh: Consume all output. * tests/test-lseek.sh: Check correct exit status, while avoiding EPIPE. Signed-off-by: Eric Blake <eblake@redhat.com>
author Eric Blake <eblake@redhat.com>
date Tue, 20 Apr 2010 09:34:04 -0600
parents edee8d927a04
children 4a27549ddb0e
files ChangeLog tests/test-lseek.sh tests/test-select-in.sh
diffstat 3 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-04-20  Eric Blake  <eblake@redhat.com>
+
+	tests: be robust to ignored SIGPIPE
+	* tests/test-select-in.sh: Consume all output.
+	* tests/test-lseek.sh: Check correct exit status, while avoiding
+	EPIPE.
+
 2010-04-20  Simon Josefsson  <simon@josefsson.org>
             Bruno Haible  <bruno@clisp.org>
 
--- a/tests/test-lseek.sh
+++ b/tests/test-lseek.sh
@@ -8,7 +8,8 @@
 ./test-lseek${EXEEXT} 0 < "$srcdir/test-lseek.sh" > t-lseek.tmp || exit 1
 
 # pipes
-echo hi | ./test-lseek${EXEEXT} 1 | cat || exit 1
+: | { ./test-lseek${EXEEXT} 1; echo $? > t-lseek.tmp; } | :
+test "x`cat t-lseek.tmp`" = x0 || exit 1
 
 # closed descriptors
 ./test-lseek${EXEEXT} 2 <&- >&- || exit 1
--- a/tests/test-select-in.sh
+++ b/tests/test-select-in.sh
@@ -18,7 +18,8 @@
 # Pipes.
 
 rm -f t-select-in.tmp
-{ sleep 1; echo abc; } | ./test-select-fd${EXEEXT} r 0 t-select-in.tmp
+{ sleep 1; echo abc; } | \
+  { ./test-select-fd${EXEEXT} r 0 t-select-in.tmp; cat > /dev/null; }
 test `cat t-select-in.tmp` = "0" || exit 1
 
 rm -f t-select-in.tmp