bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tests: be robust to ignored SIGPIPE


From: Bruno Haible
Subject: Re: [PATCH] tests: be robust to ignored SIGPIPE
Date: Sat, 1 May 2010 13:59:32 +0200
User-agent: KMail/1.9.9

Eric Blake wrote:
> * tests/test-lseek.sh: Check correct exit status, while avoiding
> EPIPE.
> 
> --- 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

This causes a test failure of Solaris. Namely, the ':' process of the third
part of the pipe terminates immediately, causing the second part of the pipe
to terminate before the 'echo $? > t-lseek.tmp' command is even run.

The approach that you used in test-select-in.sh works fine: to consume all
output.

This patch fixes it:
  1. it restores the "echo hi", whose effect is to put stdin of the test-lseek
     process into a more random state,
  2. it consumes all output.

And the second line can be simplified: The contents of t-lseek.tmp is always
empty or a nonnegative number.


2010-05-01  Bruno Haible  <address@hidden>

        lseek test: Fix failure on Solaris.
        * tests/test-lseek.sh: Partially revert 2010-04-20 commit. Consume all
        output.

--- tests/test-lseek.sh.orig    Sat May  1 13:58:15 2010
+++ tests/test-lseek.sh Sat May  1 13:25:44 2010
@@ -8,8 +8,8 @@
 ./test-lseek${EXEEXT} 0 < "$srcdir/test-lseek.sh" > t-lseek.tmp || exit 1
 
 # pipes
-: | { ./test-lseek${EXEEXT} 1; echo $? > t-lseek.tmp; } | :
-test "x`cat t-lseek.tmp`" = x0 || exit 1
+echo hi | { ./test-lseek${EXEEXT} 1; echo $? > t-lseek.tmp; cat > /dev/null; } 
| cat
+test "`cat t-lseek.tmp`" = "0" || exit 1
 
 # closed descriptors
 ./test-lseek${EXEEXT} 2 <&- >&- || exit 1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]