diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2020-04-08 17:50:55 -0400 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2020-04-08 17:50:55 -0400 |
commit | c3e4cbaab936a17b579d85c5ff28bcb2251736d0 (patch) | |
tree | 74215136ba66d70145231faea2b263f34830cabc /src | |
parent | f45b8e51b6838ab820df13983c194f737be48778 (diff) | |
download | postgresql-c3e4cbaab936a17b579d85c5ff28bcb2251736d0.tar.gz postgresql-c3e4cbaab936a17b579d85c5ff28bcb2251736d0.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/pg_validatebackup/t/003_corruption.pl | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/bin/pg_validatebackup/t/003_corruption.pl b/src/bin/pg_validatebackup/t/003_corruption.pl index 7a09d02e6c7..09f8b982504 100644 --- a/src/bin/pg_validatebackup/t/003_corruption.pl +++ b/src/bin/pg_validatebackup/t/003_corruption.pl @@ -16,6 +16,9 @@ $master->start; # Include a user-defined tablespace in the hopes of detecting problems in that # area. my $source_ts_path = TestLib::perl2host(TestLib::tempdir_short()); +my $source_ts_prefix = $source_ts_path; +$source_ts_prefix =~ s!(^[A-Z]:/[^/]*)/.*!$1!; + $master->safe_psql('postgres', <<EOM); CREATE TABLE x1 (a int); INSERT INTO x1 VALUES (111); @@ -105,6 +108,10 @@ for my $scenario (@scenario) # Take a backup and check that it validates OK. my $backup_path = $master->backup_dir . '/' . $name; my $backup_ts_path = TestLib::perl2host(TestLib::tempdir_short()); + # The tablespace map parameter confuses Msys2, which tries to mangle + # it. Tell it not to. + # See https://www.msys2.org/wiki/Porting/#filesystem-namespaces + local $ENV{MSYS2_ARG_CONV_EXCL} = $source_ts_prefix; $master->command_ok(['pg_basebackup', '-D', $backup_path, '--no-sync', '-T', "${source_ts_path}=${backup_ts_path}"], "base backup ok"); @@ -179,7 +186,14 @@ sub mutilate_missing_tablespace my $pathname = "$backup_path/pg_tblspc/$tsoid"; if ($windows_os) { - rmdir($pathname) || die "$pathname: $!"; + # rmdir works on some windows setups, unlink on others. + # Instead of trying to implement precise rules, just try one and then + # the other. + unless (rmdir($pathname)) + { + my $err = $!; + unlink($pathname) || die "$pathname: rmdir: $err, unlink: $!"; + } } else { |