Re: [PATCH 2/3] test-lib: simplify lsan results check
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 7, 2025, 16:23 UTC
- Message-ID
- <xmqqmsg2vbi1.fsf@gitster.g>
- In-Reply-To
- <20250107070752.GB584668@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 10 quoted lines
> We want to know if there are any leaks logged by LSan in the results > directory, so we run "find" on the containing directory and pipe it to > xargs. We can accomplish the same thing by just globbing in the shell > and passing the result to grep, which has a few advantages: > > - it's one fewer process to run > ... > We are now subject to command-line length limits, but that is also true > of the globbing cat used to show the logs themselves. This hasn't been a > problem in practice.
Nice to see it mentioned here. And the resulting code does become simpler to reason about.
> We do need to use "grep -s" for the case that the glob does not expand > (i.e., there are not any log files at all). This option is in POSIX, and > has been used in t7407 for several years without anybody complaining.
Also since c625bf0e (git-p4: git-p4 tests with p4 triggers, 2017-07-13) t9831 has also been using it. It is not like a stray error message about unmatched glob would really matter here, though. We are not doing 2>&1 to let the downstream of the pipe see it, and unless the test is run under "-v" option, it wouldn't even be seen.
> This also also naturally handles the case where the surrounding > directory has already been removed (in which case there are likewise no > files!), dropping the need to comment about it.
Nice.
Thanks.