git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
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 15:49:52 +0900	[thread overview]
Message-ID: <xmqqim3nb01b.fsf@gitster.g> (raw)
In-Reply-To: <YJzGcZpZ+E9R0gYd@coredump.intra.peff.net> (Jeff King's message of "Thu, 13 May 2021 02:25:53 -0400")

Jeff King <peff@peff.net> writes:

> Of course those extra lint checks are doing something useful, so paying
> a few extra seconds (at least on Linux) isn't so bad (though note the
> CPU time; we're bounded in our parallel run here by the slowest test, so
> it really is ~120s of CPU improvement).

Nice.

> 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.

Nicely done.

>  		then
>  			BUG "broken &&-chain or run-away HERE-DOC: $1"
>  		fi

  reply	other threads:[~2021-05-13  6:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-13  6:25 Jeff King
2021-05-13  6:49 ` Junio C Hamano [this message]
2021-05-13  7:23   ` Jeff King
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

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

  git send-email \
    --in-reply-to=xmqqim3nb01b.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=sunshine@sunshineco.com \
    --subject='Re: [PATCH] t: avoid sed-based chain-linting in some expensive cases' \
    /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

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).