Message ID | d27ee1e627339f2fc6a8fdf3b1be79435c9a4bc6.1573779466.git.liu.denton@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | t: general test cleanup + `set -o pipefail` | expand |
Denton Liu <liu.denton@gmail.com> writes: > In a future patch, we plan on running tests with `set -o pipefail`. > Since zipinfo is killed by SIGPIPE, it will return an error code which s/is killed/may be killed/ for the reasons I wrote for 23/27, I think. Otherwise the idea behind the patch is good. Thanks. > will propogate as a result of the pipefail. > > Mask away the return code of zipinfo so that the failure as a result of > the SIGPIPE does not propogate. > > Signed-off-by: Denton Liu <liu.denton@gmail.com> > --- > t/t5004-archive-corner-cases.sh | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/t/t5004-archive-corner-cases.sh b/t/t5004-archive-corner-cases.sh > index 3e7b23cb32..4c6d42d474 100755 > --- a/t/t5004-archive-corner-cases.sh > +++ b/t/t5004-archive-corner-cases.sh > @@ -153,7 +153,9 @@ test_expect_success ZIPINFO 'zip archive with many entries' ' > > # check the number of entries in the ZIP file directory > expr 65536 + 256 >expect && > - "$ZIPINFO" many.zip | head -2 | sed -n "2s/.* //p" >actual && > + { > + "$ZIPINFO" many.zip || : > + } | head -2 | sed -n "2s/.* //p" >actual && > test_cmp expect actual > '
diff --git a/t/t5004-archive-corner-cases.sh b/t/t5004-archive-corner-cases.sh index 3e7b23cb32..4c6d42d474 100755 --- a/t/t5004-archive-corner-cases.sh +++ b/t/t5004-archive-corner-cases.sh @@ -153,7 +153,9 @@ test_expect_success ZIPINFO 'zip archive with many entries' ' # check the number of entries in the ZIP file directory expr 65536 + 256 >expect && - "$ZIPINFO" many.zip | head -2 | sed -n "2s/.* //p" >actual && + { + "$ZIPINFO" many.zip || : + } | head -2 | sed -n "2s/.* //p" >actual && test_cmp expect actual '
In a future patch, we plan on running tests with `set -o pipefail`. Since zipinfo is killed by SIGPIPE, it will return an error code which will propogate as a result of the pipefail. Mask away the return code of zipinfo so that the failure as a result of the SIGPIPE does not propogate. Signed-off-by: Denton Liu <liu.denton@gmail.com> --- t/t5004-archive-corner-cases.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)