fixing pg_basebackup tests for modern Windows/msys2
While looking into issues with fairywren and pg_basebackup tests, I
created a similar environment but with more modern Windows / msys2.
Before it even got to the test that failed on fairywren it failed the
first TAP test for a variety of reasons, all connected to
TestLib::perl2host.
First, this function is in some cases returning paths for directories
with trailing slashes and or embedded double slashes. Both of these can
cause problems, especially when written to a tablespace map file. Also,
the cygpath invocation is returning a path with backslashes whereas "pwd
-W' returns a path with forward slashes.
So the first attached patch rectifies these problems. It fixes issues
with doubles and trailing slashes and makes cygpath return a path with
forward slashes just like the non-cygpath branch.
However, there is another problem, which is that if called on a path
that includes a symlink, on the test platform I set up it actually
resolves that link rather than just following it. The end result is that
the use of a shorter path via a symlink is effectively defeated. I
haven't found any way to stop this behaviour.
The second patch therefore adjusts the test to avoid calling perl2host
on such a path. It just calls perl2host on the symlink's parent, and
thereafter uses that result.
cheers
andrew
--
Andrew Dunstan
EDB: https://www.enterprisedb.com
Attachments:
0001-Make-TestLib-perl2host-more-consistent-and-robust.patchtext/x-patch; charset=UTF-8; name=0001-Make-TestLib-perl2host-more-consistent-and-robust.patchDownload+5-2
0002-Avoid-calling-TestLib-perl2host-on-a-symlinked-direc.patchtext/x-patch; charset=UTF-8; name=0002-Avoid-calling-TestLib-perl2host-on-a-symlinked-direc.patchDownload+7-6
On 7/28/21 9:31 AM, Andrew Dunstan wrote:
While looking into issues with fairywren and pg_basebackup tests, I
created a similar environment but with more modern Windows / msys2.
Before it even got to the test that failed on fairywren it failed the
first TAP test for a variety of reasons, all connected to
TestLib::perl2host.First, this function is in some cases returning paths for directories
with trailing slashes and or embedded double slashes. Both of these can
cause problems, especially when written to a tablespace map file. Also,
the cygpath invocation is returning a path with backslashes whereas "pwd
-W' returns a path with forward slashes.So the first attached patch rectifies these problems. It fixes issues
with doubles and trailing slashes and makes cygpath return a path with
forward slashes just like the non-cygpath branch.However, there is another problem, which is that if called on a path
that includes a symlink, on the test platform I set up it actually
resolves that link rather than just following it. The end result is that
the use of a shorter path via a symlink is effectively defeated. I
haven't found any way to stop this behaviour.The second patch therefore adjusts the test to avoid calling perl2host
on such a path. It just calls perl2host on the symlink's parent, and
thereafter uses that result.
I've pushed these in master and REL_14_STABLE.
cheers
andrew
--
Andrew Dunstan
EDB: https://www.enterprisedb.com