Skip to content

Commit dee7ad2

Browse files
committed
Fix new recovery test for use under msys
Commit caba8f0 wasn't quite right for msys, as demonstrated by several buildfarm animals, including jacana and fairywren. We need to use the msys perl in the archive command, but call it in such a way that Windows will understand the path. Furthermore, inside the copy script we need to convert a Windows path to an msys path.
1 parent a78edd4 commit dee7ad2

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

src/test/recovery/t/025_stuck_on_old_timeline.pl

+11-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
use warnings;
1111
use PostgresNode;
1212
use TestLib;
13+
14+
use File::Basename;
1315
use FindBin;
1416
use Test::More tests => 1;
1517

@@ -23,12 +25,17 @@
2325
# get there.
2426
$node_primary->init(allows_streaming => 1, has_archiving => 1);
2527
my $perlbin = $^X;
26-
$perlbin =~ s{\\}{\\\\}g if ($TestLib::windows_os);
28+
if ($^O eq 'msys')
29+
{
30+
$perlbin = TestLib::perl2host(dirname($^X)) . '\\' . basename($^X);
31+
}
32+
$perlbin =~ s!\\!/!g if $TestLib::windows_os;
2733
my $archivedir_primary = $node_primary->archive_dir;
2834
$node_primary->append_conf('postgresql.conf', qq(
29-
archive_command = '$perlbin "$FindBin::RealBin/cp_history_files" "%p" "$archivedir_primary/%f"'
35+
archive_command = '"$perlbin" "$FindBin::RealBin/cp_history_files" "%p" "$archivedir_primary/%f"'
3036
wal_keep_segments=8
3137
));
38+
local $ENV{PERL_BADLANG}=0;
3239
$node_primary->start;
3340

3441
# Take backup from primary
@@ -85,7 +92,8 @@
8592
# WAL segment, this is enough to guarantee that the history file was
8693
# archived.
8794
my $archive_wait_query =
88-
"SELECT '$walfile_to_be_archived' <= last_archived_wal FROM pg_stat_archiver;";
95+
"SELECT coalesce('$walfile_to_be_archived' <= last_archived_wal, false) " .
96+
"FROM pg_stat_archiver";
8997
$node_standby->poll_query_until('postgres', $archive_wait_query)
9098
or die "Timed out while waiting for WAL segment to be archived";
9199
my $last_archived_wal_file = $walfile_to_be_archived;

src/test/recovery/t/cp_history_files

+7
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,11 @@ use warnings;
77
die "wrong number of arguments" if @ARGV != 2;
88
my ($source, $target) = @ARGV;
99
exit if $source !~ /history/;
10+
if ($^O eq 'msys')
11+
{
12+
# make a windows path look like an msys path if necessary
13+
$source =~ s!^([A-Za-z]):!'/' . lc($1)!e;
14+
$source =~ s!\\!/!g;
15+
}
16+
1017
copy($source, $target) or die "couldn't copy $source to $target: $!";

0 commit comments

Comments
 (0)