git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "Eric Sunshine" <sunshine@sunshineco.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: Re: [PATCH] t: avoid sed-based chain-linting in some expensive cases
Date: Thu, 13 May 2021 03:23:21 -0400	[thread overview]
Message-ID: <YJzT6dUBm82L1qZa@coredump.intra.peff.net> (raw)
In-Reply-To: <xmqqim3nb01b.fsf@gitster.g>

On Thu, May 13, 2021 at 03:49:52PM +0900, Junio C Hamano wrote:

> > diff --git a/t/test-lib.sh b/t/test-lib.sh
> > index adaa2db601..adaf03543e 100644
> > --- a/t/test-lib.sh
> > +++ b/t/test-lib.sh
> > @@ -947,8 +947,11 @@ test_run_ () {
> >  		trace=
> >  		# 117 is magic because it is unlikely to match the exit
> >  		# code of other programs
> > -		if $(printf '%s\n' "$1" | sed -f "$GIT_BUILD_DIR/t/chainlint.sed" | grep -q '?![A-Z][A-Z]*?!') ||
> > -			test "OK-117" != "$(test_eval_ "(exit 117) && $1${LF}${LF}echo OK-\$?" 3>&1)"
> > +		if test "OK-117" != "$(test_eval_ "(exit 117) && $1${LF}${LF}echo OK-\$?" 3>&1)" ||
> > +		   {
> > +			test "${GIT_TEST_CHAIN_LINT_HARDER:-${GIT_TEST_CHAIN_LINT_HARDER_DEFAULT:-1}}" != 0 &&
> > +			$(printf '%s\n' "$1" | sed -f "$GIT_BUILD_DIR/t/chainlint.sed" | grep -q '?![A-Z][A-Z]*?!')
> > +		   }
> 
> We have been doing the more expensive one first, but we now
> optionally skip it while retaining the one that uses the shell.
> OK.

Oh yeah, I meant to call that out. I flipped them mostly because it made
the conditional easier to read (though as you can see, it's already
quite a mouthful).

In practice the short-circuit doesn't help us much, though. Unless a
test is buggy, we end up having to run both tests either way, no matter
the order.

-Peff

  reply	other threads:[~2021-05-13  7:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-13  6:25 [PATCH] t: avoid sed-based chain-linting in some expensive cases Jeff King
2021-05-13  6:49 ` Junio C Hamano
2021-05-13  7:23   ` Jeff King [this message]
2021-05-13 11:05 ` Martin Ågren
2021-05-14  5:48   ` Jeff King
2021-05-14  8:52     ` Martin Ågren
2021-05-15  9:19       ` Jeff King

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=YJzT6dUBm82L1qZa@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=avarab@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).