Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c3e4cba

Browse files
committed
Msys2 tweaks for pg_validatebackup corruption test
1. Tell Msys2 not to mangle the tablespace map parameter 2. If rmdir doesn't work, fall back to trying unlink on the entry in pg_tblspc. Discussion: https://postgr.es/m/7330a7c7-ce5f-9769-39a1-bdb0b32bb4a6@2ndQuadrant.com
1 parent f45b8e5 commit c3e4cba

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/bin/pg_validatebackup/t/003_corruption.pl

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
# Include a user-defined tablespace in the hopes of detecting problems in that
1717
# area.
1818
my $source_ts_path = TestLib::perl2host(TestLib::tempdir_short());
19+
my $source_ts_prefix = $source_ts_path;
20+
$source_ts_prefix =~ s!(^[A-Z]:/[^/]*)/.*!$1!;
21+
1922
$master->safe_psql('postgres', <<EOM);
2023
CREATE TABLE x1 (a int);
2124
INSERT INTO x1 VALUES (111);
@@ -105,6 +108,10 @@
105108
# Take a backup and check that it validates OK.
106109
my $backup_path = $master->backup_dir . '/' . $name;
107110
my $backup_ts_path = TestLib::perl2host(TestLib::tempdir_short());
111+
# The tablespace map parameter confuses Msys2, which tries to mangle
112+
# it. Tell it not to.
113+
# See https://www.msys2.org/wiki/Porting/#filesystem-namespaces
114+
local $ENV{MSYS2_ARG_CONV_EXCL} = $source_ts_prefix;
108115
$master->command_ok(['pg_basebackup', '-D', $backup_path, '--no-sync',
109116
'-T', "${source_ts_path}=${backup_ts_path}"],
110117
"base backup ok");
@@ -179,7 +186,14 @@ sub mutilate_missing_tablespace
179186
my $pathname = "$backup_path/pg_tblspc/$tsoid";
180187
if ($windows_os)
181188
{
182-
rmdir($pathname) || die "$pathname: $!";
189+
# rmdir works on some windows setups, unlink on others.
190+
# Instead of trying to implement precise rules, just try one and then
191+
# the other.
192+
unless (rmdir($pathname))
193+
{
194+
my $err = $!;
195+
unlink($pathname) || die "$pathname: rmdir: $err, unlink: $!";
196+
}
183197
}
184198
else
185199
{

0 commit comments

Comments
 (0)