tests: be robust to ignored SIGPIPE
authorEric Blake <eblake@redhat.com>
Tue, 20 Apr 2010 15:34:04 +0000 (09:34 -0600)
committerEric Blake <eblake@redhat.com>
Tue, 20 Apr 2010 15:44:48 +0000 (09:44 -0600)
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>
ChangeLog
tests/test-lseek.sh
tests/test-select-in.sh

index d4f1a6a..ddc0d09 100644 (file)
--- 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>
 
index e84c2bb..576008c 100755 (executable)
@@ -8,7 +8,8 @@ tmpfiles=t-lseek.tmp
 ./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
index 13f6bbb..44f5dbb 100755 (executable)
@@ -18,7 +18,8 @@ test `cat t-select-in.tmp` = "1" || exit 1
 # 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