Enable almost all TAP tests involving symlinks on Windows
authorAndrew Dunstan <andrew@dunslane.net>
Thu, 16 Jul 2020 18:48:37 +0000 (14:48 -0400)
committerAndrew Dunstan <andrew@dunslane.net>
Thu, 16 Jul 2020 19:51:52 +0000 (15:51 -0400)
commitd66b23b032d75614e1be47ca182020960d89206d
tree6628bfd3ab5f59d9823b171ea447c9404e84d72d
parent932f9fb504a57f296cf698d15bd93462ddfe2776
Enable almost all TAP tests involving symlinks on Windows

Windows has junction points which function as symbolic links for
directories. This patch introduces a new function TestLib::dir_symlink()
which creates a junction point on Windows and a standard Unix type
symbolic link elsewhere.

The function TestLib::perl2host is also modified, first to use cygpath
where it's available (e.g. msys2) and second to allow it to succeed if
the gandparent directory exists but the parent does not.

Given these changes the only symlink tests that need to be skipped on
Windows are those related to permissions or to use of readlink. The
relevant tests for pg_basebackup and pg_rewind are therefore adjusted
accordingly.

Andrew Dunstan, reviewed by Peter Eisentraut and Michael Paquier.

Discussion: https://postgr.es/m/c50a646c-d9bb-7c62-a4bf-8256ff6ff338@2ndquadrant.com
src/bin/pg_basebackup/t/010_pg_basebackup.pl
src/bin/pg_dump/t/010_dump_connstr.pl
src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
src/test/perl/TestLib.pm