Skip to content

Commit 450bf0b

Browse files
committed
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.
1 parent d20f7d5 commit 450bf0b

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/Makefile.global.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ cd $(srcdir) && TESTDIR='$(CURDIR)' PATH="$(bindir):$$PATH" PGPORT='6$(DEF_PGPOR
322322
endef
323323

324324
define prove_check
325-
rm -rf $(srcdir)/tmp_check/log
325+
rm -rf $(CURDIR)/tmp_check/log
326326
cd $(srcdir) && TESTDIR='$(CURDIR)' $(with_temp_install) PGPORT='6$(DEF_PGPORT)' top_builddir='$(CURDIR)/$(top_builddir)' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) t/*.pl
327327
endef
328328

src/test/perl/TestLib.pm

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ our @EXPORT = qw(
2323
program_options_handling_ok
2424
command_like
2525
issues_sql_like
26+
27+
$tmp_check
28+
$log_path
2629
);
2730

2831
use Cwd;
@@ -37,8 +40,10 @@ use Test::More;
3740

3841
# Open log file. For each test, the log file name uses the name of the
3942
# file launching this module, without the .pl suffix.
40-
my $log_path = 'tmp_check/log';
41-
mkdir 'tmp_check';
43+
our ($tmp_check, $log_path);
44+
$tmp_check = $ENV{TESTDIR} ? "$ENV{TESTDIR}/tmp_check" : "tmp_check";
45+
$log_path = "$tmp_check/log";
46+
mkdir $tmp_check;
4247
mkdir $log_path;
4348
my $test_logfile = basename($0);
4449
$test_logfile =~ s/\.[^.]+$//;
@@ -128,19 +133,19 @@ sub start_test_server
128133
print("### Starting test server in $tempdir\n");
129134
standard_initdb "$tempdir/pgdata";
130135
$ret = system_log('pg_ctl', '-D', "$tempdir/pgdata", '-w', '-l',
131-
"$tempdir/logfile", '-o',
136+
"$log_path/postmaster.log", '-o',
132137
"--fsync=off -k \"$tempdir_short\" --listen-addresses='' --log-statement=all",
133138
'start');
134139
if ($ret != 0)
135140
{
136141
print "# pg_ctl failed; logfile:\n";
137-
system('cat', "$tempdir/logfile");
142+
system('cat', "$log_path/postmaster.log");
138143
BAIL_OUT("pg_ctl failed");
139144
}
140145

141146
$ENV{PGHOST} = $tempdir_short;
142147
$test_server_datadir = "$tempdir/pgdata";
143-
$test_server_logfile = "$tempdir/logfile";
148+
$test_server_logfile = "$log_path/postmaster.log";
144149
}
145150

146151
sub restart_test_server

0 commit comments

Comments
 (0)