diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2021-06-12 08:37:16 -0400 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2021-06-12 08:54:28 -0400 |
commit | 1730a3334e4a791b88cfc39bd45bee5a0d7b817c (patch) | |
tree | de2191a3ff4c1d65ca0243fe8cae0eaa02b58a2f | |
parent | b56ef31bf946337a47a797250a3d8b6ca22cbade (diff) | |
download | postgresql-1730a3334e4a791b88cfc39bd45bee5a0d7b817c.tar.gz postgresql-1730a3334e4a791b88cfc39bd45bee5a0d7b817c.zip |
Fix new recovery test for use under msys
Commit caba8f0d43 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.
-rw-r--r-- | src/test/recovery/t/025_stuck_on_old_timeline.pl | 14 | ||||
-rw-r--r-- | src/test/recovery/t/cp_history_files | 7 |
2 files changed, 18 insertions, 3 deletions
diff --git a/src/test/recovery/t/025_stuck_on_old_timeline.pl b/src/test/recovery/t/025_stuck_on_old_timeline.pl index 8099571299c..b97b83e4e48 100644 --- a/src/test/recovery/t/025_stuck_on_old_timeline.pl +++ b/src/test/recovery/t/025_stuck_on_old_timeline.pl @@ -10,6 +10,8 @@ use strict; use warnings; use PostgresNode; use TestLib; + +use File::Basename; use FindBin; use Test::More tests => 1; @@ -23,12 +25,17 @@ my $node_primary = get_new_node('primary'); # get there. $node_primary->init(allows_streaming => 1, has_archiving => 1); my $perlbin = $^X; -$perlbin =~ s{\\}{\\\\}g if ($TestLib::windows_os); +if ($^O eq 'msys') +{ + $perlbin = TestLib::perl2host(dirname($^X)) . '\\' . basename($^X); +} +$perlbin =~ s!\\!/!g if $TestLib::windows_os; my $archivedir_primary = $node_primary->archive_dir; $node_primary->append_conf('postgresql.conf', qq( -archive_command = '$perlbin "$FindBin::RealBin/cp_history_files" "%p" "$archivedir_primary/%f"' +archive_command = '"$perlbin" "$FindBin::RealBin/cp_history_files" "%p" "$archivedir_primary/%f"' wal_keep_segments=8 )); +local $ENV{PERL_BADLANG}=0; $node_primary->start; # Take backup from primary @@ -74,7 +81,8 @@ $node_standby->safe_psql('postgres', 'SELECT pg_switch_wal()'); # WAL segment, this is enough to guarantee that the history file was # archived. my $archive_wait_query = - "SELECT '$walfile_to_be_archived' <= last_archived_wal FROM pg_stat_archiver;"; + "SELECT coalesce('$walfile_to_be_archived' <= last_archived_wal, false) " . + "FROM pg_stat_archiver"; $node_standby->poll_query_until('postgres', $archive_wait_query) or die "Timed out while waiting for WAL segment to be archived"; my $last_archived_wal_file = $walfile_to_be_archived; diff --git a/src/test/recovery/t/cp_history_files b/src/test/recovery/t/cp_history_files index cfeea41e5b9..66f1b598fea 100644 --- a/src/test/recovery/t/cp_history_files +++ b/src/test/recovery/t/cp_history_files @@ -7,4 +7,11 @@ use warnings; die "wrong number of arguments" if @ARGV != 2; my ($source, $target) = @ARGV; exit if $source !~ /history/; +if ($^O eq 'msys') +{ + # make a windows path look like an msys path if necessary + $source =~ s!^([A-Za-z]):!'/' . lc($1)!e; + $source =~ s!\\!/!g; +} + copy($source, $target) or die "couldn't copy $source to $target: $!"; |