Re: pgsql: Require version 0.98 of Test::More for TAP tests

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Noah Misch <noah(at)leadboat(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Require version 0.98 of Test::More for TAP tests
Date: 2021-11-21 14:02:49
Message-ID: 57050e42-7717-3131-1704-80ce0ad4a9f2@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers


On 11/20/21 20:10, Noah Misch wrote:
> On Sat, Nov 20, 2021 at 07:50:02PM -0500, Tom Lane wrote:
>> Noah Misch <noah(at)leadboat(dot)com> writes:
>>> Yep. wrasse sets PERL to a manually-installed Perl, but PROVE still uses an
>>> old Perl. I'll fix that somehow.
>> A quick workaround is to set PROVE in the animal's config_env, but
>> I don't think that's ideal, because configure then skips module
>> presence tests:
>>
>> # Check for necessary modules, unless user has specified the "prove" to use;
>> # in that case it's her responsibility to have a working configuration.
>> # (prove might be part of a different Perl installation than perl, eg on
>> # MSys, so the result of AX_PROG_PERL_MODULES could be irrelevant anyway.)
> The skip would be unnecessary if configure just tested whether $PROVE can run
> a test requiring the module. We're testing $PERL, but we're actually
> indifferent to $PERL's Test::More.

Yeah, we could do something along these lines:

andrew(at)emma:pg_head $ cat moduletest.pl
use IPC::Run 0.79;
use Test::More 0.98;
use Time::HiRes 1.52;
diag("");
diag("Test::More::VERSION: $Test::More::VERSION");
diag("IPC::Run::VERSION: $IPC::Run::VERSION");
diag("Tme::HiRes::VERSION: $Time::HiRes::VERSION");
ok(1);
done_testing();
andrew(at)emma:pg_head $ prove moduletest.pl
moduletest.pl .. #
# Test::More::VERSION: 1.302183
# IPC::Run::VERSION: 20200505.0
# Tme::HiRes::VERSION: 1.9764
moduletest.pl .. ok
All tests successful.
Files=1, Tests=1, 0 wallclock secs ( 0.04 usr 0.01 sys + 0.13 cusr 0.02 csys = 0.20 CPU)
Result: PASS

If I hack up the test to fail I get:

andrew(at)emma:pg_head $ prove moduletest.pl
moduletest.pl .. Test::More version 9.98 required--this is only version 1.302183 at moduletest.pl line 2.
BEGIN failed--compilation aborted at moduletest.pl line 2.
moduletest.pl .. Dubious, test returned 255 (wstat 65280, 0xff00)
No subtests run
Test Summary Report
-------------------
moduletest.pl (Wstat: 65280 Tests: 0 Failed: 0)
 Non-zero exit status: 255
  Parse errors: No plan found in TAP output
Files=1, Tests=0,  0 wallclock secs ( 0.03 usr  0.01 sys +  0.12 cusr  0.02 csys =  0.18 CPU)
Result: FAIL

which is clear enough.

prove is pretty much always a script - if we want to know which perl is
invoked we could look at its shebang line.

cheers

andrew

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

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2021-11-21 15:55:42 Re: pgsql: Require version 0.98 of Test::More for TAP tests
Previous Message Tom Lane 2021-11-21 01:55:12 Re: pgsql: Require version 0.98 of Test::More for TAP tests