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 1mc8bS-0002qr-W5 for pgsql-committers@arkaria.postgresql.org; Sun, 17 Oct 2021 16:01:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mc8bR-0005OY-7Y for pgsql-committers@arkaria.postgresql.org; Sun, 17 Oct 2021 16:01:37 +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 1mc8bR-0005OO-13 for pgsql-committers@lists.postgresql.org; Sun, 17 Oct 2021 16:01:37 +0000 Received: from relay2-d.mail.gandi.net ([217.70.183.194]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mc8bN-0003gh-IB for pgsql-committers@lists.postgresql.org; Sun, 17 Oct 2021 16:01:35 +0000 Received: (Authenticated sender: adsend@dunslane.net) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id D34A340006; Sun, 17 Oct 2021 16:01:29 +0000 (UTC) Subject: Re: pgsql: Reference test binary using TESTDIR in 001_libpq_pipeline.pl. From: Andrew Dunstan To: Andres Freund Cc: pgsql-committers@lists.postgresql.org References: <4941f5a5-2d50-1a0e-6701-14c5fefe92d6@dunslane.net> <20211008211427.e2j2f3vnhjd3peda@alap3.anarazel.de> Message-ID: Date: Sun, 17 Oct 2021 12:01:27 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------8EA824BE9AF403019E0BA9C0" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------8EA824BE9AF403019E0BA9C0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 10/8/21 8:33 PM, Andrew Dunstan wrote: > On 10/8/21 5:14 PM, Andres Freund wrote: >> Hi, >> >> On 2021-10-08 11:41:50 -0400, Andrew Dunstan wrote: >>> On 10/1/21 6:34 PM, Andres Freund wrote: >>>> Reference test binary using TESTDIR in 001_libpq_pipeline.pl. >>>> >>>> The previous approach didn't really work on windows, due to the PATH separator >>>> being ';' not ':'. Instead of making the PATH change more complicated, >>>> reference the binary using the TESTDIR environment. >>>> >>>> Reported-By: Andres Freund >>>> Suggested-By: Andrew Dunstan >>>> Discussion: https://postgr.es/m/20210930214040.odkdd42vknvzifm6@alap3.anarazel.de >>>> Backpatch: 14-, where the test was introduced. >>>> >>> I don't think any of us were thinking very clearly about this. Of >>> course, MSVC doesn't build executables in $TESTDIR. If we want to pick >>> up the executable from where it's built we'll need a little help from >>> vcregress.pl. I haven't tested it but What I have in mind is something >>> like the attached. >> Hm. Clearly this needs more work. But I don't really like having checks for >> MSBUILDDIR in individual tests - we should do this somewhere more central. >> Afaictl the windows build just installs libpq_pipeline.exe. If we make sure >> that on !msvc builds CURDIR is on PATH and on msvc temp_install/bin/ is on >> PATH (which it should already be), then we should be good? >> >> I guess the reason this didn't work for me before was that I invoked >> install.pl from the top directory, which then didn't install >> libpq_pipeline.exe, because of the config.pl issue I mentioned somewhere? > > > The whole point of 6abc8c2596 AIUI was to have this program not > installed (that's why for the test we need to get it from $TESTDIR where > it's built except when we're using MSVC). That commit should probably > have made sure the MSVC install process likewise didn't install it. So > ISTM that relying on it being installed is going in the wrong direction. > > It's been 10 days or so, so we really need to get this fixed. Is the attached more to your taste? cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com --------------8EA824BE9AF403019E0BA9C0 Content-Type: text/x-patch; charset=UTF-8; name="libpq_pipeline_fix.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="libpq_pipeline_fix.patch" diff --git a/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl b/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl index 6721edfa71..2bb8053fda 100644 --- a/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl +++ b/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl @@ -14,8 +14,7 @@ $node->init; $node->start; my $numrows = 700; -my $libpq_pipeline = "$ENV{TESTDIR}/libpq_pipeline"; - +my $libpq_pipeline = TestLib::find_built_program('libpq_pipeline'); my ($out, $err) = run_command([ $libpq_pipeline, 'tests' ]); die "oops: $err" unless $err eq ''; my @tests = split(/\s+/, $out); diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm index 06aae1760e..89e16a45c7 100644 --- a/src/test/perl/TestLib.pm +++ b/src/test/perl/TestLib.pm @@ -75,6 +75,7 @@ our @EXPORT = qw( system_log run_log run_command + find_built_program command_ok command_fails @@ -1000,6 +1001,41 @@ sub command_checks_all =pod +=item find_built_program(program_name) + +Find the ath to an uninstalled built program according to the build type. + +Arguments: + +=over + +=item C: name (without extension) of the program to look for + +=back + +=cut + +sub find_built_program +{ + my $program = shift; + my $path; + + if (defined $ENV{MSBUILDDIR}) + { + # vcregress.pl sets MSBUILDDIR which is the root of all the build dirs + my $wanted = sub { $_ eq "$program.exe" && $path = $File::Find::name;}; + File::Find::find($wanted,$ENV{MSBUILDDIR}); + } + elsif (defined $ENV{TESTDIR} && -e "$ENV{TESTDIR}/$program") + { + # non-MSVC programs are built in situ in the build tree + $path = "$ENV{TESTDIR}/$program"; + } + return $path; +} + +=pod + =back =cut diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl index 35e8f67f01..7d46b9f0cc 100644 --- a/src/tools/msvc/vcregress.pl +++ b/src/tools/msvc/vcregress.pl @@ -60,6 +60,7 @@ copy("$Config/regress/regress.dll", "src/test/regress"); copy("$Config/dummy_seclabel/dummy_seclabel.dll", "src/test/regress"); $ENV{PATH} = "$topdir/$Config/libpq;$ENV{PATH}"; +$ENV{MSBUILDDIR} = "$topdir/$Config"; if ($ENV{PERL5LIB}) { --------------8EA824BE9AF403019E0BA9C0--