Confusing TAP tests readme file

From: Ildar Musin <i(dot)musin(at)postgrespro(dot)ru>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Confusing TAP tests readme file
Date: 2016-07-25 10:42:33
Message-ID: 5795ED19.3070208@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

I was checking out TAP tests documentation. And I found confusing this
part of src/test/perl/README file:

my $ret = $node->psql('postgres', 'SELECT 1');
is($ret, '1', 'SELECT 1 returns 1');

The returning value of psql() function is the exit code of the psql.
Hence this test will never pass since psql returns 0 if query was
successfully executed. Probably it was meant to be the safe_psql()
function instead which returns stdout:

my $ret = $node->safe_psql('postgres', 'SELECT 1');
is($ret, '1', 'SELECT 1 returns 1');

or else:

my ($ret, $stdout, $stderr) =
$node->psql('postgres', 'SELECT 1');
is($stdout, '1', 'SELECT 1 returns 1');

The attached patch fixes this.

Regards,
Ildar Musin

--
Ildar Musin
i(dot)musin(at)postgrespro(dot)ru

Attachment Content-Type Size
tap_doc.patch text/x-patch 429 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2016-07-25 10:45:58 Optimizing numeric SUM() aggregate
Previous Message Andrew Borodin 2016-07-25 09:30:45 Re: Re: GiST optimizing memmoves in gistplacetopage for fixed-size updates [PoC]