Re: TAP tests and symlinks on Windows

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>
Cc: Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: TAP tests and symlinks on Windows
Date: 2020-06-12 06:59:57
Message-ID: 20200612065957.GA3362@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jun 09, 2020 at 11:26:19AM +0100, Dagfinn Ilmari Mannsåker wrote:
> Amusingly, Win32::Symlink uses a copy of our pgsymlink(), which emulates
> symlinks via junction points:
>
> https://metacpan.org/source/AUDREYT/Win32-Symlink-0.06/pgsymlink.c

Oh, interesting point. Thanks for the reference!

> A portable way of using symlinks if possible would be:
>
> # In a BEGIN block because it overrides CORE::GLOBAL::symlink, which
> # only takes effect on code that's compiled after the override is
> # installed. We don't care if it fails, since it works without on
> # some Windows perls.
> [...]
>
> Plus a note in the Win32 docs that Win32::Symlink may be required to run
> some tests on some Perl/Windows versions..

Planting such a check in individual scripts is not a good idea because
it would get forgotten. The best way to handle that is to add a new
check in the BEGIN block of TestLib.pm. Note that we already do that
with createFile, OsFHandleOpen and CloseHandle. Now the question is:
do we really want to make this a hard requirement? I would like to
answer yes so as we make sure that this gets always tested, and this
needs proper documentation as you say. Now it would be also possible
to check if the API is present in the BEGIN block of TestLib.pm, and
then use an independent variable similar to what we do with
$use_unix_sockets to decide if tests should be skipped or not, but you
cannot know if this gets actually, or ever, tested.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2020-06-12 07:03:04 Re: [Patch] pg_rewind: options to use restore_command from recovery.conf or command line
Previous Message Amit Langote 2020-06-12 06:46:41 Re: making update/delete of inheritance trees scale better