Re: pgsql: Close stdin where it's not needed in TestLib.pm procedures

From: Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Close stdin where it's not needed in TestLib.pm procedures
Date: 2019-11-26 12:51:50
Message-ID: 5923a6e0-2528-de1b-725d-adbc131e61a4@2ndQuadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers


On 11/26/19 3:47 AM, Michael Paquier wrote:
> On Tue, Nov 26, 2019 at 02:13:50AM -0500, Tom Lane wrote:
>> Perhaps the "where possible" caveat needs to include a test whether
>> IO::Pty is installed? It's evidently not there by default everywhere.
>>
>> It's possible that we should just move the goalposts and say IO::Pty
>> is required for TAP testing. I can foresee that we'll have to do
>> that if we ever want automated tests of psql's tab completion,
>> for example.
> Hmm. I am not sure that we are at that point yet (in which case we'd
> need to check after it in configure). Any other modules we require to
> be installed are directly imported to our code, but here we visibly
> have a dependency forced by the loaded code. My point is that it does
> not impact platforms that do not need it, so it seems like a waste to
> require for everybody something which is actually necessary only for a
> portion of users running the TAP tests.

Yeah, I don't want to go that far at this stage at least.

here's my proposed fix.

I will adjust the code that wants to use it to have a block containing
the tests that need the pty code something like this:

SKIP:
{
  skip 3, "no Pty support" unless $have_io_pty;
  ...
}

cheers

andrew

--
Andrew Dunstan https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
fix-testlib-pty.patch text/x-patch 1.9 KB

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Andrew Dunstan 2019-11-26 12:53:34 Re: pgsql: Use native methods to open input in TestLib::slurp_file on Windo
Previous Message Amit Kapila 2019-11-26 12:36:38 Re: pgsql: Fix unportable printf format introduced in commit 9290ad198.