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

Re: [PATCH] trace2: intercept all common signals

From
Jeff King <peff@peff.net>
Date
May 10, 2024, 22:20 UTC
Message-ID
<20240510222030.GD1962678@coredump.intra.peff.net>
In-Reply-To
<xmqqle4h4d99.fsf@gitster.g>
On Fri, May 10, 2024 at 01:34:42PM -0700, Junio C Hamano wrote:
Show 11 quoted lines
> Emily Shaffer <nasamuffin@google.com> writes:
> 
> > While I'm at it, since you pointed out ! instead of test_must_fail, I
> > wondered if I should change "! test_grep" as well - but when I grep t/
> > it looks like it's not usual to use `test_must_fail test_grep`, but
> > instead to use `test_grep ! <omitted pattern> <file>`. I'll change
> > that too.
> 
> "! test_grep" is an anti-pattern.  We should have a documentation
> somewhere in t/README or nearby (if we don't, somebody please add
> one).
Better than documentation, maybe something like:
diff --git a/t/check-non-portable-shell.pl b/t/check-non-portable-shell.pl
index b2b28c2ced..7de2c30aa0 100755
--- a/t/check-non-portable-shell.pl
+++ b/t/check-non-portable-shell.pl
@@ -51,6 +51,7 @@ sub err {
 		err q(quote "$val" in 'local var=$val');
 	/^\s*([A-Z0-9_]+=(\w*|(["']).*?\3)\s+)+(\w+)/ and exists($func{$4}) and
 		err '"FOO=bar shell_func" assignment extends beyond "shell_func"';
+	/! test_grep/ and err 'do not invert test_* functions';
 	$line = '';
 	# this resets our $. for each file
 	close ARGV if eof;

There's at least one other case already. If you shorten it to just "!
test_" to catch more functions, you can see there are a lot of wrong
test_cmp invocations, too (maybe not quite as bad because we don't
produce a specific message, but we'd yield a confusing diff output).

But I think we can't cover everything; there are some like
test_have_prereq which obviously are invertible.

-Peff
Previous: Junio C HamanoNext: Jeff King
Message 9 of 14 in “trace2: intercept all common signals”
  1. trace2: intercept all common signalsEmily Shaffer, May 10, 2024
  2. Emily ShafferMay 10, 2024
  3. Junio C HamanoMay 10, 2024
  4. Emily ShafferMay 10, 2024
  5. Jeff KingMay 10, 2024
  6. Emily ShafferMay 10, 2024
  7. Jeff KingMay 10, 2024
  8. Junio C HamanoMay 10, 2024
  9. Jeff KingMay 10, 2024
  10. Jeff KingMay 10, 2024
  11. Emily ShafferMay 13, 2024
  12. Jeff KingMay 16, 2024
  13. Junio C HamanoMay 16, 2024
  14. Jeff KingMay 23, 2024

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.