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

Re: [PATCH] tests: send "bug in the test script" errors to the script's stderr

From
Jeff King <peff@peff.net>
Date
Nov 19, 2018, 19:44 UTC
Message-ID
<20181119194432.GA7330@sigill.intra.peff.net>
In-Reply-To
<20181119131326.2435-1-szeder.dev@gmail.com>
On Mon, Nov 19, 2018 at 02:13:26PM +0100, SZEDER Gábor wrote:
Show 8 quoted lines
> Send these "bug in the test script" error messages directly to the
> test scripts standard error and thus to the terminal, so those bugs
> will be much harder to overlook.  Instead of updating all ~20 such
> 'error' calls with a redirection, let's add a BUG() function to
> 'test-lib.sh', wrapping an 'error' call with the proper redirection
> and also including the common prefix of those error messages, and
> convert all those call sites [4] to use this new BUG() function
> instead.
Yes, I think this is an improvement.
> +BUG () {
> +	error >&7 "bug in the test script: $*"
> +}

I naively expected this to go to >&4, but of course that is the conditional "stderr or /dev/null, depending on --verbose" descriptor. I have a feeling that we could get rid of descriptors 5 and 7 in favor of 3 and 4, if we did the conditional redirection when running each test, instead of ahead of time.

But unless we are running out of descriptors, it's not worth the effort (it's debatable whether we are; 9be795fbce (t5615: avoid re-using descriptor 4, 2017-12-08) made me nervous, but it's more about the special-ness of BASHE_XTRACEFD than anything).

Anyway, that's all a tangent to your patch.

I do notice that many of the existing "FATAL:" errors use descriptor 5, which goes to stdout. I'm not sure if those should actually be going to stderr (or if there's some TAP significance to those lines).

-Peff
Previous: SZEDER GáborNext: SZEDER Gábor
Message 2 of 6 in “tests: send "bug in the test script" errors to the script's stderr”
  1. tests: send "bug in the test script" errors to the script's stderrSZEDER Gábor, Nov 19, 2018
  2. Jeff KingNov 19, 2018
  3. SZEDER GáborNov 19, 2018
  4. Jeff KingNov 20, 2018
  5. Jeff KingNov 20, 2018
  6. SZEDER GáborNov 20, 2018

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.