git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t: avoid sed-based chain-linting in some expensive cases

From
Junio C Hamano <gitster@pobox.com>
Date
May 13, 2021, 06:49 UTC
Message-ID
<xmqqim3nb01b.fsf@gitster.g>
In-Reply-To
<YJzGcZpZ+E9R0gYd@coredump.intra.peff.net>
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.
Show 15 quoted lines
> 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
Previous: Jeff KingNext: Jeff King
Message 2 of 7 in “t: avoid sed-based chain-linting in some expensive cases”
  1. t: avoid sed-based chain-linting in some expensive casesJeff King, May 13, 2021
  2. Junio C HamanoMay 13, 2021
  3. Jeff KingMay 13, 2021
  4. Martin ÅgrenMay 13, 2021
  5. Jeff KingMay 14, 2021
  6. Martin ÅgrenMay 14, 2021
  7. Jeff KingMay 15, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.