Make tap tests store postmaster logs and handle vpaths correctly
Given this it is possible that the buildfarm animals running these tests will be able to capture adequate logging to allow diagnosis of failures.
This commit is contained in:
parent
6f2871f12e
commit
01f6bb4b2d
|
@ -338,7 +338,7 @@ cd $(srcdir) && TESTDIR='$(CURDIR)' PATH="$(bindir):$$PATH" PGPORT='6$(DEF_PGPOR
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define prove_check
|
define prove_check
|
||||||
rm -rf $(srcdir)/tmp_check/log
|
rm -rf $(CURDIR)/tmp_check/log
|
||||||
cd $(srcdir) && TESTDIR='$(CURDIR)' $(with_temp_install) PGPORT='6$(DEF_PGPORT)' top_builddir='$(CURDIR)/$(top_builddir)' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) t/*.pl
|
cd $(srcdir) && TESTDIR='$(CURDIR)' $(with_temp_install) PGPORT='6$(DEF_PGPORT)' top_builddir='$(CURDIR)/$(top_builddir)' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) t/*.pl
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
|
@ -72,9 +72,6 @@ our $test_standby_datadir = "$testroot/data_standby";
|
||||||
|
|
||||||
mkdir $testroot;
|
mkdir $testroot;
|
||||||
|
|
||||||
# Log files are created here
|
|
||||||
mkdir "regress_log";
|
|
||||||
|
|
||||||
# Define non-conflicting ports for both nodes.
|
# Define non-conflicting ports for both nodes.
|
||||||
my $port_master = $ENV{PGPORT};
|
my $port_master = $ENV{PGPORT};
|
||||||
my $port_standby = $port_master + 1;
|
my $port_standby = $port_master + 1;
|
||||||
|
@ -202,6 +199,7 @@ local replication all trust
|
||||||
|
|
||||||
system_or_bail('pg_ctl' , '-w',
|
system_or_bail('pg_ctl' , '-w',
|
||||||
'-D' , $test_master_datadir,
|
'-D' , $test_master_datadir,
|
||||||
|
'-l', "$log_path/master.log",
|
||||||
"-o", "-k $tempdir_short --listen-addresses='' -p $port_master",
|
"-o", "-k $tempdir_short --listen-addresses='' -p $port_master",
|
||||||
'start');
|
'start');
|
||||||
|
|
||||||
|
@ -228,6 +226,7 @@ recovery_target_timeline='latest'
|
||||||
|
|
||||||
# Start standby
|
# Start standby
|
||||||
system_or_bail('pg_ctl', '-w', '-D', $test_standby_datadir,
|
system_or_bail('pg_ctl', '-w', '-D', $test_standby_datadir,
|
||||||
|
'-l', "$log_path/standby.log",
|
||||||
'-o', "-k $tempdir_short --listen-addresses='' -p $port_standby",
|
'-o', "-k $tempdir_short --listen-addresses='' -p $port_standby",
|
||||||
'start');
|
'start');
|
||||||
|
|
||||||
|
@ -323,6 +322,7 @@ recovery_target_timeline='latest'
|
||||||
|
|
||||||
# Restart the master to check that rewind went correctly
|
# Restart the master to check that rewind went correctly
|
||||||
system_or_bail('pg_ctl', '-w', '-D', $test_master_datadir,
|
system_or_bail('pg_ctl', '-w', '-D', $test_master_datadir,
|
||||||
|
'-l', "$log_path/master.log",
|
||||||
'-o', "-k $tempdir_short --listen-addresses='' -p $port_master",
|
'-o', "-k $tempdir_short --listen-addresses='' -p $port_master",
|
||||||
'start');
|
'start');
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,9 @@ our @EXPORT = qw(
|
||||||
program_options_handling_ok
|
program_options_handling_ok
|
||||||
command_like
|
command_like
|
||||||
issues_sql_like
|
issues_sql_like
|
||||||
|
|
||||||
|
$tmp_check
|
||||||
|
$log_path
|
||||||
);
|
);
|
||||||
|
|
||||||
use Cwd;
|
use Cwd;
|
||||||
|
@ -37,8 +40,10 @@ use Test::More;
|
||||||
|
|
||||||
# Open log file. For each test, the log file name uses the name of the
|
# Open log file. For each test, the log file name uses the name of the
|
||||||
# file launching this module, without the .pl suffix.
|
# file launching this module, without the .pl suffix.
|
||||||
my $log_path = 'tmp_check/log';
|
our ($tmp_check, $log_path);
|
||||||
mkdir 'tmp_check';
|
$tmp_check = $ENV{TESTDIR} ? "$ENV{TESTDIR}/tmp_check" : "tmp_check";
|
||||||
|
$log_path = "$tmp_check/log";
|
||||||
|
mkdir $tmp_check;
|
||||||
mkdir $log_path;
|
mkdir $log_path;
|
||||||
my $test_logfile = basename($0);
|
my $test_logfile = basename($0);
|
||||||
$test_logfile =~ s/\.[^.]+$//;
|
$test_logfile =~ s/\.[^.]+$//;
|
||||||
|
@ -132,19 +137,19 @@ sub start_test_server
|
||||||
print("### Starting test server in $tempdir\n");
|
print("### Starting test server in $tempdir\n");
|
||||||
standard_initdb "$tempdir/pgdata";
|
standard_initdb "$tempdir/pgdata";
|
||||||
$ret = system_log('pg_ctl', '-D', "$tempdir/pgdata", '-w', '-l',
|
$ret = system_log('pg_ctl', '-D', "$tempdir/pgdata", '-w', '-l',
|
||||||
"$tempdir/logfile", '-o',
|
"$log_path/postmaster.log", '-o',
|
||||||
"--fsync=off -k \"$tempdir_short\" --listen-addresses='' --log-statement=all",
|
"--fsync=off -k \"$tempdir_short\" --listen-addresses='' --log-statement=all",
|
||||||
'start');
|
'start');
|
||||||
if ($ret != 0)
|
if ($ret != 0)
|
||||||
{
|
{
|
||||||
print "# pg_ctl failed; logfile:\n";
|
print "# pg_ctl failed; logfile:\n";
|
||||||
system('cat', "$tempdir/logfile");
|
system('cat', "$log_path/postmaster.log");
|
||||||
BAIL_OUT("pg_ctl failed");
|
BAIL_OUT("pg_ctl failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
$ENV{PGHOST} = $tempdir_short;
|
$ENV{PGHOST} = $tempdir_short;
|
||||||
$test_server_datadir = "$tempdir/pgdata";
|
$test_server_datadir = "$tempdir/pgdata";
|
||||||
$test_server_logfile = "$tempdir/logfile";
|
$test_server_logfile = "$log_path/postmaster.log";
|
||||||
}
|
}
|
||||||
|
|
||||||
sub restart_test_server
|
sub restart_test_server
|
||||||
|
|
Loading…
Reference in New Issue