Re: [PATCH 10/27] t4138: stop losing return codes of git commands

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

 



On Thu, Nov 14, 2019 at 8:01 PM Denton Liu <liu.denton@xxxxxxxxx> wrote:
> In a pipe, only the return code of the last command is used. Thus, all
> other commands will have their return codes masked. Rewrite pipes so
> that there are no git commands upstream so that we will know if a
> command fails.
>
> Signed-off-by: Denton Liu <liu.denton@xxxxxxxxx>
> ---
> diff --git a/t/t4138-apply-ws-expansion.sh b/t/t4138-apply-ws-expansion.sh
> @@ -17,8 +17,8 @@ test_expect_success setup '
> -       git diff --no-index before after |
> -               sed -e "s/before/test-1/" -e "s/after/test-1/" >patch1.patch &&
> +       test_must_fail git diff --no-index before after >patch1.patch.raw &&
> +       sed -e "s/before/test-1/" -e "s/after/test-1/" patch1.patch.raw >patch1.patch &&

I think this is a semantically incorrect use of test_must_fail(). What
you're interested here is that git-diff found differences (as opposed
to not finding any), so you want to test its exit code which reflects
whether or not the files were different. Hence, the following would be
more appropriate:

    test_expect_code 1 git diff --no-index before after >patch1.patch.raw &&

Same comment applies to remaining changes in this patch.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux