Re: [PATCH v2 3/5] tests: turn GPG, GPGSM and RFC1991 into lazy prereqs

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

 



On Fri, Mar 27, 2020 at 02:37:02PM -0700, Junio C Hamano wrote:

> >>  And here are the "don'ts:"
> >>
> >>   - Don't exit() within a <script> part.
> >
> > We use 'exit 1' to terminate subshells[1] inside tests.
> >
> > [1]: https://lore.kernel.org/git/20150325052952.GE31924@xxxxxxxx/
> 
> Yeah, I gave two alternatives, but the third one could be
> 
>        test_expect_success 'git frotz on various versions' '
>            (
>              for revision in one two three
>              do
>                      echo "frotz $revision" >expect &&
>                      git frotz "$revision" >actual &&
>                      test_cmp expect actual || exit 1
>              done 
>            ) &&
>            test something else
>        '

We definitely shouldn't suggest _introducing_ a subshell for this
purpose. It's longer to write and less efficient.

> Anyway, that existing rule is not what I added in the rough draft
> under discussion.  To clarify it, we'd end up needing "unless A, B
> or C" that may be too complex.  I dunno.

I think the existing rule is OK. If you know enough to create the
situation where "exit 1" is useful, then you probably know enough to
know when to break that rule. That said, I'm not opposed to something
like:

  - Don't call "exit" within a <script> part, unless you're in a
    subshell. It will cause the whole to test script to exit (and fail).

or something.

-Peff



[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