Re: TAP output format in pg_regress

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Nikolay Shaplov <dhyan(at)nataraj(dot)su>, Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>, 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-24 21:20:01
Message-ID: 467AAA52-CD0E-4B33-ACA4-6AEA1384E473@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 24 Nov 2022, at 20:32, Andres Freund <andres(at)anarazel(dot)de> wrote:
>
> On November 24, 2022 11:07:43 AM PST, Daniel Gustafsson <daniel(at)yesql(dot)se> wrote:
>>> On 24 Nov 2022, at 18:07, Nikolay Shaplov <dhyan(at)nataraj(dot)su> wrote:
>> One option could be to redefine bail() to take the exit function as a parameter
>> and have the caller pass the preferred exit handler.
>>
>> -bail_out(bool non_rec, const char *fmt,...)
>> +bail(void (*exit_func)(int), const char *fmt,...)
>>
>> The callsites would then look like the below, which puts a reference to the
>> actual exit handler used in the code where it is called.
>
> I'd just rename _bail to bail_noatexit().

That's probably the best option, done in the attached along with the comment
fixup to mention the recursion issue.

>>> This magic spell "...%-5i %s%-*s %8.0f ms\n" is too dark to repeat it even two
>>> times. I understand problems with spaces... But may be it would be better
>>> somehow narrow it to one ugly print... Print "ok %-5i "|"not ok %-5i" to
>>> buffer first, and then have one "%s%-*s %8.0f ms%s\n" print or something like
>>> that...
>>
>> I'm not convinced that this printf format is that hard to read (which may well
>> be attributed to Stockholm Syndrome), and I do think that breaking it up and
>> adding more code to print the line will make it less readable instead.
>
> I don't think it's terrible either. I do think it'd also be ok to switch between ok / not ok within a single printf, making it easier to keep them in sync.

I made it into a single printf to see what it would look like, with some
additional comments to make it more readable (I'm not a fan of where pgindent
moves those but..).

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

Attachment Content-Type Size
v12-0001-Change-pg_regress-output-format-to-be-TAP-compli.patch application/octet-stream 35.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hamid Akhtar 2022-11-24 21:45:01 Re: Allow pageinspect's bt_page_stats function to return a set of rows instead of a single row
Previous Message David Rowley 2022-11-24 21:12:59 Re: indentation in _hash_pgaddtup()