• Michael Paquier's avatar
    Improve setup of environment values for commands in MSVC's vcregress.pl · ca9e9b08
    Michael Paquier authored
    The current setup assumes that commands for lz4, zstd and gzip always
    exist by default if not enforced by a user's environment.  However,
    vcpkg, as one example, installs libraries but no binaries, so this
    default setup to assume that a command should always be present would
    cause failures.  This commit improves the detection of such external
    commands as follows:
    * If a ENV value is available, trust the environment/user and use it.
    * If a ENV value is not available, check its execution by looking in the
    current PATH, by launching a simple "$command --version" (that should be
    portable enough).
    ** On execution failure, ignore ENV{command}.
    ** On execution success, set ENV{command} = "$command".
    
    Note that this new rule applies to gzip, lz4 and zstd but not tar that
    we assume will always exist.  Those commands are set up in the
    environment only when using bincheck and taptest.  The CI includes all
    those commands and I have checked that their setup is correct there.  I
    have also tested this change in a MSVC environment where we have none of
    those commands.
    
    While on it, remove the references to lz4 from the documentation and
    vcregress.pl in ~v13.  --with-lz4 has been added in v14~ so there is no
    point to have this information in these older branches.
    
    Reported-by: Andrew Dunstan
    Reviewed-by: Andrew Dunstan
    Discussion: https://postgr.es/m/14402151-376b-a57a-6d0c-10ad12608e12@dunslane.net
    Backpatch-through: 10
    ca9e9b08
vcregress.pl 20.4 KB