git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Denton Liu <liu.denton@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Eric Sunshine <sunshine@sunshineco.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH 6/8] t9164: don't use `test_must_fail test_cmp`
Date: Tue, 21 Apr 2020 16:16:27 -0400	[thread overview]
Message-ID: <20200421201627.GA9357@generichostname> (raw)
In-Reply-To: <xmqqr1whrkaa.fsf@gitster.c.googlers.com>

On Mon, Apr 20, 2020 at 01:09:49PM -0700, Junio C Hamano wrote:
> Eric Sunshine <sunshine@sunshineco.com> writes:
> 
> > On Mon, Apr 20, 2020 at 4:55 AM Denton Liu <liu.denton@gmail.com> wrote:
> >> The test_must_fail function should only be used for git commands since
> >> we assume that external commands work sanely. Since test_cmp() just
> >> wraps an external command, replace `test_must_fail test_cmp` with
> >> `! test_cmp`.
> >>
> >> Signed-off-by: Denton Liu <liu.denton@gmail.com>
> >> ---
> >> diff --git a/t/t9164-git-svn-dcommit-concurrent.sh b/t/t9164-git-svn-dcommit-concurrent.sh
> >> @@ -103,7 +103,7 @@ test_expect_success 'check if pre-commit hook fails' '
> >> -               test_must_fail svn_cmd commit -m "this commit should fail" &&
> >> +               ! svn_cmd commit -m "this commit should fail" &&
> >
> > Hmm, this doesn't look like 'test_cmp' mentioned in the commit message.
> 
> Yeah, the other hunk is about test_cmp and this hunk is about
> svn_cmd.  The stated rationale applies to both wrappers, I think.
> 
>     Subject: [PATCH 6/8] t9164: use test_must_fail only on git
> 
>     The `test_must_fail` function should only be used for git commands;
>     we are not in the business of catching segmentation fault by external
>     commands.  Shell helper functions test_cmp and svn_cmd used in this
>     script are wrappers around external commands, so just use `! cmd`
>     instead of `test_must_fail cmd`
> 
> perhaps, without any change to the code?

Thanks, this looks good to me too.

  parent reply	other threads:[~2020-04-21 20:16 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-20  8:54 [PATCH 0/8] t: replace incorrect test_must_fail usage (part 4) Denton Liu
2020-04-20  8:54 ` [PATCH 1/8] t6030: use test_path_is_missing() Denton Liu
2020-04-20  8:54 ` [PATCH 2/8] t7408: replace incorrect uses of test_must_fail Denton Liu
2020-04-20  8:54 ` [PATCH 3/8] t7508: don't use `test_must_fail test_cmp` Denton Liu
2020-04-21 20:59   ` Johannes Sixt
2020-04-20  8:54 ` [PATCH 4/8] t9141: use test_path_is_missing() Denton Liu
2020-04-20  8:54 ` [PATCH 5/8] t9160: " Denton Liu
2020-04-20  8:54 ` [PATCH 6/8] t9164: don't use `test_must_fail test_cmp` Denton Liu
2020-04-20 16:21   ` Eric Sunshine
2020-04-20 20:09     ` Junio C Hamano
2020-04-20 20:13       ` Eric Sunshine
2020-04-21 20:16       ` Denton Liu [this message]
2020-04-21 20:44         ` Junio C Hamano
2020-04-22  8:54           ` Denton Liu
2020-04-22 15:50             ` Junio C Hamano
2020-04-20  8:54 ` [PATCH 7/8] t9819: don't use test_must_fail with p4 Denton Liu
2020-04-20  8:54 ` [PATCH 8/8] t9902: don't use `test_must_fail __git_*` Denton Liu
2020-04-21 21:16   ` Johannes Sixt
2020-04-22  8:35     ` Denton Liu
2020-04-20 11:49 ` [PATCH 0/8] t: replace incorrect test_must_fail usage (part 4) Derrick Stolee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200421201627.GA9357@generichostname \
    --to=liu.denton@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).