Re: TAP output format in pg_regress
Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
From: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
To: Andres Freund <andres@anarazel.de>
Cc: Daniel Gustafsson <daniel@yesql.se>, Nikolay Shaplov
<dhyan@nataraj.su>, PostgreSQL Developers
<pgsql-hackers@lists.postgresql.org>, Andrew Dunstan
<andrew@dunslane.net>, Tom Lane <tgl@sss.pgh.pa.us>, Peter Eisentraut
<peter.eisentraut@enterprisedb.com>
Date: 2022-11-21T13:42:25Z
Lists: pgsql-hackers
Andres Freund <andres@anarazel.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.
> Greetings,
>
> Andres Freund
- ilmari
Commits
-
pg_regress: Emit TAP compliant output
- 558fff0adfa0 16.0 landed
-
Consider a failed process as a failed test in pg_regress
- 337903a16fb0 16.0 landed
-
Avoid reference to nonexistent array element in ExecInitAgg().
- 92957ed98c5c 16.0 cited