Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1moqvo-0005m1-CI for pgsql-committers@arkaria.postgresql.org; Sun, 21 Nov 2021 17:47:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1moqvk-0003ft-Ee for pgsql-committers@arkaria.postgresql.org; Sun, 21 Nov 2021 17:47:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1moqvj-0003fe-Vq for pgsql-committers@lists.postgresql.org; Sun, 21 Nov 2021 17:47:08 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1moqvd-000847-A3 for pgsql-committers@lists.postgresql.org; Sun, 21 Nov 2021 17:47:06 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 1ALHksYa3468630; Sun, 21 Nov 2021 12:46:54 -0500 From: Tom Lane To: Andrew Dunstan cc: Noah Misch , pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Require version 0.98 of Test::More for TAP tests In-reply-to: <3441609.1637510142@sss.pgh.pa.us> References: <3369543.1637454364@sss.pgh.pa.us> <3369927.1637454743@sss.pgh.pa.us> <20211121003630.GA1362012@rfd.leadboat.com> <3371085.1637455802@sss.pgh.pa.us> <20211121011026.GB1362012@rfd.leadboat.com> <57050e42-7717-3131-1704-80ce0ad4a9f2@dunslane.net> <3441609.1637510142@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Sun, 21 Nov 2021 10:55:42 -0500" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <3468579.1637516772.0@sss.pgh.pa.us> Date: Sun, 21 Nov 2021 12:46:54 -0500 Message-ID: <3468629.1637516814@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3468579.1637516772.1@sss.pgh.pa.us> I wrote: > Seems reasonable to me, although it's not entirely clear how to hook > the output into configure's practices --- in particular, people using > "./configure -q" might not be pleased by unwanted diagnostic output. > But that could probably be dealt with. Here's a draft patch based on Andrew's script. I'm not entirely satisfied with it, because I couldn't get the output to go where I wanted. I think that the reports of actual module versions should go to config.log, and not appear in configure's user-visible output, because (a) 99% of people won't care, and (b) otherwise we don't have a good way to silence them under -q, where 100% of people won't care. However, the only way I could get that to happen was to redirect prove's stderr to config.log (&AS_MESSAGE_LOG_FD), which is not great because it means that in the failure case the only place where any useful info appears is config.log. I tried printing the version reports to STDOUT instead of using diag(), but that seems to get redirected to /dev/null somewhere. Anybody know how to get prove to not do that? regards, tom lane ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="test-module-versions-under-prove-wip.patch"; charset="us-ascii" Content-ID: <3468579.1637516772.2@sss.pgh.pa.us> Content-Description: test-module-versions-under-prove-wip.patch Content-Transfer-Encoding: quoted-printable diff --git a/config/check_modules.pl b/config/check_modules.pl new file mode 100644 index 0000000000..55b522c6a7 --- /dev/null +++ b/config/check_modules.pl @@ -0,0 +1,20 @@ +# +# Verify that required Perl modules are available, +# in at least the required minimum versions. +# (The required minimum versions are all quite ancient now, +# but specify them anyway for documentation's sake.) +# +use IPC::Run 0.79; +# While here, we might as well report exactly what versions we found. +diag("IPC::Run::VERSION: $IPC::Run::VERSION"); + +# Test::More and Time::HiRes are supposed to be part of core Perl, +# but some distros omit them in a minimal installation. +use Test::More 0.98; +diag("Test::More::VERSION: $Test::More::VERSION"); + +use Time::HiRes 1.52; +diag("Time::HiRes::VERSION: $Time::HiRes::VERSION"); + +ok(1); +done_testing(); diff --git a/configure b/configure index 977b4d3df5..c58c9ca051 100755 --- a/configure +++ b/configure @@ -19410,98 +19410,7 @@ fi # Check for test tools # if test "$enable_tap_tests" =3D yes; then - # Check for necessary modules, unless user has specified the "prove" to= use; - # in that case it's her responsibility to have a working configuration. - # (prove might be part of a different Perl installation than perl, eg o= n - # MSys, so the result of AX_PROG_PERL_MODULES could be irrelevant anywa= y.) - if test -z "$PROVE"; then - # Test::More and Time::HiRes are supposed to be part of core Perl, - # but some distros omit them in a minimal installation. - # The required minimum versions are all quite ancient now, but specif= y - # them anyway for documentation's sake. - - - - - - - - - - -# Make sure we have perl -if test -z "$PERL"; then -# Extract the first word of "perl", so it can be a program name with args= . -set dummy perl; ac_word=3D$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_PERL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$PERL"; then - ac_cv_prog_PERL=3D"$PERL" # Let the user override the test. -else -as_save_IFS=3D$IFS; IFS=3D$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=3D$as_save_IFS - test -z "$as_dir" && as_dir=3D. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_PERL=3D"perl" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec= _ext" >&5 - break 2 - fi -done - done -IFS=3D$as_save_IFS - -fi -fi -PERL=3D$ac_cv_prog_PERL -if test -n "$PERL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 -$as_echo "$PERL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi - -if test "x$PERL" !=3D x; then - ax_perl_modules_failed=3D0 - for ax_perl_module in 'IPC::Run 0.79' 'Test::More 0.98' 'Time::HiRes 1.= 52' ; do - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for perl module $ax= _perl_module" >&5 -$as_echo_n "checking for perl module $ax_perl_module... " >&6; } - - # Would be nice to log result here, but can't rely on autoconf intern= als - modversion=3D`$PERL -e "use $ax_perl_module; my \\\$x=3Dq($ax_perl_mo= dule); \\\$x =3D~ s/ .*//; \\\$x .=3D q(::VERSION); eval qq{print \\\\$\\\= $x\\n}; exit;" 2>/dev/null` - if test $? -ne 0; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; }; - ax_perl_modules_failed=3D1 - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $modversion" >&5 -$as_echo "$modversion" >&6; }; - fi - done - - # Run optional shell commands - if test "$ax_perl_modules_failed" =3D 0; then - : - - else - : - as_fn_error $? "Additional Perl modules are required to run TAP tests= " "$LINENO" 5 - fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not find perl" = >&5 -$as_echo "$as_me: WARNING: could not find perl" >&2;} -fi - fi - # Now make sure we know where prove is + # Make sure we know where prove is. if test -z "$PROVE"; then for ac_prog in prove do @@ -19559,6 +19468,20 @@ fi if test -z "$PROVE"; then as_fn_error $? "prove not found" "$LINENO" 5 fi + # Check for necessary Perl modules. You might think we should use + # AX_PROG_PERL_MODULES here, but prove might be part of a different Per= l + # installation than perl, eg on MSys, so we have to check using prove. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl modules requ= ired for TAP tests" >&5 +$as_echo_n "checking for Perl modules required for TAP tests... " >&6; } + "$PROVE" "$srcdir/config/check_modules.pl" >&5 2>&1 + if test $? -eq 0; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "Additional Perl modules are required to run TAP tests= " "$LINENO" 5 + fi fi = # If compiler will take -Wl,--as-needed (or various platform-specific diff --git a/configure.ac b/configure.ac index 95e5169c4f..90fed2f33b 100644 --- a/configure.ac +++ b/configure.ac @@ -2377,23 +2377,22 @@ PGAC_PATH_PROGS(DBTOEPUB, dbtoepub) # Check for test tools # if test "$enable_tap_tests" =3D yes; then - # Check for necessary modules, unless user has specified the "prove" to= use; - # in that case it's her responsibility to have a working configuration. - # (prove might be part of a different Perl installation than perl, eg o= n - # MSys, so the result of AX_PROG_PERL_MODULES could be irrelevant anywa= y.) - if test -z "$PROVE"; then - # Test::More and Time::HiRes are supposed to be part of core Perl, - # but some distros omit them in a minimal installation. - # The required minimum versions are all quite ancient now, but specif= y - # them anyway for documentation's sake. - AX_PROG_PERL_MODULES([IPC::Run=3D0.79 Test::More=3D0.98 Time::HiRes=3D= 1.52], , - [AC_MSG_ERROR([Additional Perl modules are required to run TAP test= s])]) - fi - # Now make sure we know where prove is + # Make sure we know where prove is. PGAC_PATH_PROGS(PROVE, prove) if test -z "$PROVE"; then AC_MSG_ERROR([prove not found]) fi + # Check for necessary Perl modules. You might think we should use + # AX_PROG_PERL_MODULES here, but prove might be part of a different Per= l + # installation than perl, eg on MSys, so we have to check using prove. + AC_MSG_CHECKING(for Perl modules required for TAP tests) + "$PROVE" "$srcdir/config/check_modules.pl" >&AS_MESSAGE_LOG_FD 2>&1 + if test $? -eq 0; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + AC_MSG_ERROR([Additional Perl modules are required to run TAP tests]) + fi fi = # If compiler will take -Wl,--as-needed (or various platform-specific ------- =_aaaaaaaaaa0--