Re: TAP output format in pg_regress

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Nikolay Shaplov <dhyan(at)nataraj(dot)su>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Subject: Re: TAP output format in pg_regress
Date: 2022-11-22 22:17:44
Message-ID: CE7234E7-B9FA-4338-8FB5-D3F84494A5E2@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 21 Nov 2022, at 14:42, Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org> wrote:
>
> Andres Freund <andres(at)anarazel(dot)de> writes:
>
>> But either way, it seems nicer to output the # inside a helper function?
>
> Note that the helper function should inject '# ' at the start of every
> line in the message, not just the first line. It might also be worth
> having two separate functions: one that prints to stdout, so is only
> shown by the harness is in verbose mode, and another which prints to
> stderr, so is always shown. Perl's Test::More calls these note() and
> diag(), respectively.
>
>>> + /*
>>> + * In order for this information (or any error information) to be shown
>>> + * when running pg_regress test suites under prove it needs to be emitted
>>> + * stderr instead of stdout.
>>> + */
>>> if (file_size(difffilename) > 0)
>>> {
>>> - printf(_("The differences that caused some tests to fail can be viewed in the\n"
>>> - "file \"%s\". A copy of the test summary that you see\n"
>>> - "above is saved in the file \"%s\".\n\n"),
>>> + status(_("\n# The differences that caused some tests to fail can be viewed in the\n"
>>> + "# file \"%s\". A copy of the test summary that you see\n"
>>> + "# above is saved in the file \"%s\".\n\n"),
>>> difffilename, logfilename);
>>
>> The comment about needing to print to stderr is correct - but the patch
>> doesn't do so (anymore)?
>>
>> The count of failed tests also should go to stderr (but not the report of all
>> tests having passed).
>>
>> bail() probably also ought to print the error to stderr, so the most important
>> detail is immediately visible when looking at the failed test result.
>
> Agreed on all three points.

The attached v10 attempts to address the points raised above. Notes and
diagnostics are printed to stdout/stderr respectively and the TAP emitter is
changed to move more of the syntax into it making it less painful on the
translators.

--
Daniel Gustafsson https://vmware.com/

Attachment Content-Type Size
v10-0002-Experimental-meson-treat-regress-tests-as-TAP.patch application/octet-stream 793 bytes
v10-0001-Make-pg_regress-output-format-TAP-compliant.patch application/octet-stream 35.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2022-11-22 22:28:12 Re: pgstattuple: add test for coverage
Previous Message Peter Smith 2022-11-22 22:16:20 Re: PGDOCS - Logical replication GUCs - added some xrefs