Re: [PATCH 3/6] t9107: use "return 1" instead of "exit 1"

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

 



On Fri, May 13, 2016 at 4:47 PM, Jeff King <peff@xxxxxxxx> wrote:
> When a test runs a loop, it cannot rely on the usual
> &&-chaining to propagate a failure inside the loop; it needs
> to break out with a failure signal. However, unless you are
> in a subshell, doing so with "exit 1" will exit the entire
> test script, not just the test snippet we are in (and cause
> the harness to complain that test_done was never reached).
> [...snip...]
>
> Signed-off-by: Jeff King <peff@xxxxxxxx>
> ---
> diff --git a/t/t9107-git-svn-migrate.sh b/t/t9107-git-svn-migrate.sh
> @@ -70,30 +72,38 @@ test_expect_success 'initialize a multi-repository repo' '
>  # refs should all be different, but the trees should all be the same:
> -test_expect_success 'multi-fetch works on partial urls + paths' "
> +test_expect_success 'multi-fetch works on partial urls + paths' '
> +       refs="trunk a b tags/0.1 tags/0.2 tags/0.3" &&
>         git svn multi-fetch &&
> -       for i in trunk a b tags/0.1 tags/0.2 tags/0.3; do
> -               git rev-parse --verify refs/remotes/origin/\$i^0 >> refs.out || exit 1;
> -           done &&
> -       test -z \"\$(sort < refs.out | uniq -d)\" &&
> -       for i in trunk a b tags/0.1 tags/0.2 tags/0.3; do
> -         for j in trunk a b tags/0.1 tags/0.2 tags/0.3; do
> -               if test \$j != \$i; then continue; fi
> -           test -z \"\$(git diff refs/remotes/origin/\$i \
> -                                refs/remotes/origin/\$j)\" ||exit 1; done; done
> -       "
> +       for i in $refs
> +       do
> +               git rev-parse --verify refs/remotes/origin/$i^0 || return 1;
> +       done >refs.out &&
> +       test -z "$(sort <refs.out | uniq -d)" &&
> +       >expect &&

What's this 'expect' file for? Is it leftover gunk from before you
settled on 'diff --exit-code'?

> +       for i in $refs
> +       do
> +               for j in $refs
> +               do
> +                       git diff --exit-code refs/remotes/origin/$i refs/remotes/origin/$j ||
> +                               return 1
> +               done
> +       done
> +'
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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]