Re: bug/oversight in TestLib.pm and PostgresNode.pm

From: Erik Rijkers <er(at)xs4all(dot)nl>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>, peter(dot)eisentraut(at)2ndquadrant(dot)com
Subject: Re: bug/oversight in TestLib.pm and PostgresNode.pm
Date: 2017-03-23 09:13:53
Message-ID: 117bff982e656467f9e19e2a26e383ad@xs4all.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2017-03-23 03:28, Michael Paquier wrote:
> On Thu, Mar 23, 2017 at 12:51 AM, Erik Rijkers <er(at)xs4all(dot)nl> wrote:
>> While trying to test pgbench's stderr (looking for 'creating tables'
>> in
>> output of the initialisation step) I ran into these two bugs (or
>> perhaps
>> better 'oversights').
>
> + if (defined $expected_stderr) {
> + like($stderr, $expected_stderr, "$test_name: stderr matches");
> + }
> + else {
> is($stderr, '', "$test_name: no stderr");
> - like($stdout, $expected_stdout, "$test_name: matches");
> + }
> To simplify that you could as well set expected_output to be an empty
> string, and just use like() instead of is(), saving this if/else.

(I'll assume you meant '$expected_stderr' (not 'expected_output'))

That would be nice but with that, other tests start complaining:
"doesn't look like a regex to me"

To avoid that, I uglified your version back to:

+ like($stderr, (defined $expected_stderr ? $expected_stderr :
qr{}),
+ "$test_name: stderr matches");

I did it like that in the attached patch
(0001-testlib-like-stderr.diff).

The other (PostgresNode.pm.diff) is unchanged.

make check-world without error.

Thanks,

Erik Rijkers

Attachment Content-Type Size
0001-testlib-like-stderr.diff text/x-diff 782 bytes
PostgresNode.pm.diff text/x-diff 566 bytes

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2017-03-23 09:15:43 Re: Fix for grammatical error in code-comment
Previous Message Magnus Hagander 2017-03-23 08:50:20 Re: [PATCH v1] Add and report the new "in_hot_standby" GUC pseudo-variable.