Ensure the right perl is used for TAP tests on msys
authorAndrew Dunstan <[email protected]>
Fri, 18 Feb 2022 21:59:30 +0000 (16:59 -0500)
committerAndrew Dunstan <[email protected]>
Sun, 20 Feb 2022 16:51:44 +0000 (11:51 -0500)
In particular, perl with $Config{osname} = msys should only be used if
the build target is msys (which is currently buildable but not usable).
For builds targeted at native Windows, perl from the ucrt64 toolchain is
suitable.

Discussion: https://postgr.es/m/20220216210141[email protected]

config/check_modules.pl
configure
configure.ac

index cc0a7ab0e7a39a733413248e9b49de6224ff843f..470c3e9c144f4e177c2f7313e783746d8d1726e1 100644 (file)
@@ -6,6 +6,7 @@
 #
 use strict;
 use warnings;
+use Config;
 
 use IPC::Run 0.79;
 
@@ -19,5 +20,9 @@ diag("IPC::Run::VERSION: $IPC::Run::VERSION");
 diag("Test::More::VERSION: $Test::More::VERSION");
 diag("Time::HiRes::VERSION: $Time::HiRes::VERSION");
 
+# Check that if prove is using msys perl it is for an msys target
+ok(($ENV{__CONFIG_HOST_OS__} || "") eq 'msys',
+   "Msys perl used for correct target")
+  if $Config{osname} eq 'msys';
 ok(1);
 done_testing();
index ca890b8b07ebdcebcc98ebbbc33bc4e272fa2321..f3cb5c2b5117c421aca6d6b80397e06ec87affae 100755 (executable)
--- a/configure
+++ b/configure
@@ -19758,6 +19758,7 @@ fi
   # installation than perl, eg on MSys, so we have to check using prove.
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl modules required for TAP tests" >&5
 $as_echo_n "checking for Perl modules required for TAP tests... " >&6; }
+  __CONFIG_HOST_OS__=$host_os; export __CONFIG_HOST_OS__
   modulestderr=`"$PROVE" "$srcdir/config/check_modules.pl" 2>&1 >/dev/null`
   if test $? -eq 0; then
     # log the module version details, but don't show them interactively
index 331683b33635b447dee338ed65b88b8dc490a1a3..19d1a803673f96f30e3cc103fe244953aceea6fe 100644 (file)
@@ -2432,6 +2432,7 @@ if test "$enable_tap_tests" = yes; then
   # AX_PROG_PERL_MODULES here, but prove might be part of a different Perl
   # installation than perl, eg on MSys, so we have to check using prove.
   AC_MSG_CHECKING(for Perl modules required for TAP tests)
+  __CONFIG_HOST_OS__=$host_os; export __CONFIG_HOST_OS__
   [modulestderr=`"$PROVE" "$srcdir/config/check_modules.pl" 2>&1 >/dev/null`]
   if test $? -eq 0; then
     # log the module version details, but don't show them interactively