Re: [PATCHv2 4/6] t7510: exit for loop with test result
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Jun 13, 2014, 12:54 UTC
- Message-ID
- <539AF49F.3010309@viscovery.net>
- In-Reply-To
- <539AEF7E.1050402@drmicha.warpmail.net>
Am 6/13/2014 14:33, schrieb Michael J Gruber:
Show 16 quoted lines
> .... with this loop, sorry: > > for X in true false; do > for Y in false true; do > ($X && $Y || exit 1) > done > echo "$X/last inner $Y: $?" > done > > gives > > true/last inner true: 0 > false/last inner true: 1 > > even though on both cases we have at least one failure of Y. (failure of > one subtest = failure of the test)
Place the loop(s) inside the subshell, and you observe termination on the first failure, and a failure exit code of the subshell.
The change proposed in this patch should not be necessary. Something else must be wrong with your tests.
Ah, here it is:
@@ -58,7 +58,7 @@ test_expect_success GPG 'show signatures' ' ( for commit in merge^2 fourth-unsigned sixth-unsigned seventh-unsigned do - git show --pretty=short --show-signature $commit >actual && + git show --pretty=short --show-signature $commit >actual || exit 1 grep "Good signature from" actual && exit 1 ! grep "BAD signature from" actual || exit 1 echo $commit OK Notice the '&& exit 1'! It should be '|| exit 1', right? -- Hannes