From 0a10438b84061e197967d2d591f0e8fca864dcb7 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 20 Apr 2010 09:34:04 -0600 Subject: [PATCH] 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 --- ChangeLog | 7 +++++++ tests/test-lseek.sh | 3 ++- tests/test-select-in.sh | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index d4f1a6a45..ddc0d09aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-04-20 Eric Blake + + 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 Bruno Haible diff --git a/tests/test-lseek.sh b/tests/test-lseek.sh index e84c2bb49..576008c42 100755 --- a/tests/test-lseek.sh +++ b/tests/test-lseek.sh @@ -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 diff --git a/tests/test-select-in.sh b/tests/test-select-in.sh index 13f6bbb8b..44f5dbb8e 100755 --- a/tests/test-select-in.sh +++ b/tests/test-select-in.sh @@ -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 -- 2.11.0