Re: tests for client programs

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: tests for client programs
Date: 2014-04-30 16:09:15
Message-ID: 20140430160915.GF30324@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2014-04-04 16:44:46 +0200, Andres Freund wrote:
> On 2014-02-27 21:44:48 -0500, Peter Eisentraut wrote:
> > +open HBA, ">>$tempdir/pgdata/pg_hba.conf";
> > +print HBA "local replication all trust\n";
> > +print HBA "host replication all 127.0.0.1/32 trust\n";
> > +print HBA "host replication all ::1/128 trust\n";
> > +close HBA;
>
> Given the recent make check security discussions, this doesn't seem like
> a good idea...
>
> > +issues_sql_like(['createdb', 'foobar1'], qr/statement: CREATE DATABASE foobar1/, 'SQL CREATE DATABASE run');
> > +issues_sql_like(['createdb', 'foobar2', '-l', 'C', '-E', 'LATIN1', '-T', 'template0'], qr/statement: CREATE DATABASE foobar2 ENCODING 'LATIN1'/, 'create database with encoding');
>
> Hm. Are all platforms guaranteed to provide latin1?
>
> > diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm
> > +if (!$ENV{PGPORT}) {
> > + $ENV{PGPORT} = 65432;
> > +}
> > +
> > +$ENV{PGPORT} = int($ENV{PGPORT}) % 65536;
>
> Hm. I think this should use logical similar to what pg_regress is using,
> namely test a few ports.
>
> > +sub start_test_server {
> > + my ($tempdir) = @_;
> > + my $ret;
> > +
> > + system "initdb -D $tempdir/pgdata -A trust -N >/dev/null";
> > + $ret = system 'pg_ctl', '-D', "$tempdir/pgdata", '-s', '-w', '-l', "$tempdir/logfile", '-o', "--fsync=off -k $tempdir --listen-addresses='' --log-statement=all", 'start';
> > +
> > + if ($ret != 0) {
> > + system('cat', "$tempdir/logfile");
> > + BAIL_OUT("pg_ctl failed");
> > + }
> > +
> > + $ENV{PGHOST} = $tempdir;
> > + $test_server_datadir = "$tempdir/pgdata";
> > + $test_server_logfile = "$tempdir/logfile";
> > +}
>
> Should stuff like --fsync-off, -k, really be on by default?
>
> I think the code to massage pg_hba.conf should also be here, there'll be
> a fair number of tests that need it.

The issues here don't seem to have been addressed in the commit. At
least the latin1 thing should be fixed.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2014-04-30 16:17:54 Re: tests for client programs
Previous Message Andrew Dunstan 2014-04-30 15:58:29 Re: Fix initdb for path with whitespace and at char