Re: IPC::Run::time[r|out] vs our TAP tests

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: IPC::Run::time[r|out] vs our TAP tests
Date: 2025-02-20 13:06:12
Message-ID: 7c5e2289-549c-4af9-b42e-fcd7f3426ab6@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2025-02-19 We 6:56 PM, Daniel Gustafsson wrote:
>> On 19 Feb 2025, at 23:08, Andrew Dunstan<andrew(at)dunslane(dot)net> wrote:
>> On 2024-10-31 Th 6:18 PM, Heikki Linnakangas wrote:
> Thanks for review!
>
>>> Perhaps sommething like this:
>>>
>>> "Close the psql session and clean up resources. Each psql session must be closed with C<quit> before the end of the test.
>>> Returns TRUE if psql exited successfully (i.e. with zero exit code), otherwise returns FALSE and reports a test failure."
>>>
>>> Would that be accurate?
>> I would be OK with Heikki's version.
> Fixed.
>
>> The patches have bitrotted slightly.
> The attached rebases over current HEAD and passes check-world locally for me.
>
>> Also this is wrong, I think:
>>
>> isnt($self->{timeout}->is_expired, 'psql query_until timed out');
>>
>> I think it should be
>>
>> ok(! $self->{timeout}->is_expired, 'psql query_until did not time out');
> Fixed.

Actually, since ok() and friends return true iff the test succeeds,
instead of

+    ok(! $self->{timeout}->is_expired, 'psql query_until did not time
out');
+    return undef if $self->{timeout}->is_expired;

you can avoid doing the same test twice and say:

     ok(! $self->{timeout}->is_expired, 'psql query_until did not time
out') || return undef;

although for slightly technical reasons perlcritic disapproves of
"return undef" and prefers that you just write a bare "return" so we
should also fix that.

Sorry for taking a second bite at the cherry.

cheers

andrew

--
Andrew Dunstan
EDB:https://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rahila Syed 2025-02-20 13:26:49 Re: Enhancing Memory Context Statistics Reporting
Previous Message Hayato Kuroda (Fujitsu) 2025-02-20 12:51:17 RE: ReplicationSlotRelease() crashes when the instance is in the single user mode