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 1mdf5x-0003Xt-Os for pgsql-committers@arkaria.postgresql.org; Thu, 21 Oct 2021 20:55:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mdf5w-0004gp-La for pgsql-committers@arkaria.postgresql.org; Thu, 21 Oct 2021 20:55:24 +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 1mdf5w-0004gB-FN for pgsql-committers@lists.postgresql.org; Thu, 21 Oct 2021 20:55:24 +0000 Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mdf5t-0001kJ-9g for pgsql-committers@lists.postgresql.org; Thu, 21 Oct 2021 20:55:23 +0000 Received: (Authenticated sender: adsend@dunslane.net) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id E7D77E0006; Thu, 21 Oct 2021 20:55:16 +0000 (UTC) Subject: Re: pgsql: Reference test binary using TESTDIR in 001_libpq_pipeline.pl. To: Tom Lane Cc: Andres Freund , Alvaro Herrera , pgsql-committers@lists.postgresql.org References: <202110181423.cmd34pruwlry@alvherre.pgsql> <20211020163123.adogznqee7oosvj5@alap3.anarazel.de> <1ccbc9a2-1e0f-93bf-745d-99b3409e10ae@dunslane.net> <20211020190916.bzvnmo6kxeqehczv@alap3.anarazel.de> <2276280.1634766519@sss.pgh.pa.us> From: Andrew Dunstan Message-ID: Date: Thu, 21 Oct 2021 16:55:10 -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: <2276280.1634766519@sss.pgh.pa.us> Content-Type: multipart/mixed; boundary="------------EAFC9DC41E7A8ACFCB0537CC" 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. --------------EAFC9DC41E7A8ACFCB0537CC Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 10/20/21 5:48 PM, Tom Lane wrote: > Andrew Dunstan writes: >> OK, it turns out that it's better to put the addition at the end of the >> PATH, otherise initdb complains that it can't find postgres in the same >> directory. > That seems horribly unsafe, or at least prone to pulling in the > program from some other versuion of Postgres. How about ordering > the path like > > PATH="$(abs_top_builddir)/tmp_install$(bindir):$(CURDIR):$$PATH" > > fair point. See attached. Tested on MSVC and Linux cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com --------------EAFC9DC41E7A8ACFCB0537CC Content-Type: text/x-patch; charset=UTF-8; name="libpq_pipeline_fix5.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="libpq_pipeline_fix5.patch" diff --git a/src/Makefile.global.in b/src/Makefile.global.in index a1da1ea4ee..533c12fef9 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -438,7 +438,7 @@ ld_library_path_var = LD_LIBRARY_PATH # need something more here. If not defined then the expansion does # nothing. with_temp_install = \ - PATH="$(abs_top_builddir)/tmp_install$(bindir):$$PATH" \ + PATH="$(abs_top_builddir)/tmp_install$(bindir):$(CURDIR):$$PATH" \ $(call add_to_path,$(strip $(ld_library_path_var)),$(abs_top_builddir)/tmp_install$(libdir)) \ $(with_temp_install_extra) @@ -449,8 +449,8 @@ define prove_installcheck rm -rf '$(CURDIR)'/tmp_check $(MKDIR_P) '$(CURDIR)'/tmp_check cd $(srcdir) && \ - TESTDIR='$(CURDIR)' PATH="$(bindir):$$PATH" PGPORT='6$(DEF_PGPORT)' \ - top_builddir='$(CURDIR)/$(top_builddir)' \ + TESTDIR='$(CURDIR)' PATH="$(bindir):$(CURDIR):$$PATH" \ + PGPORT='6$(DEF_PGPORT)' top_builddir='$(CURDIR)/$(top_builddir)' \ PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' \ $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl) endef @@ -459,8 +459,8 @@ define prove_installcheck rm -rf '$(CURDIR)'/tmp_check $(MKDIR_P) '$(CURDIR)'/tmp_check cd $(srcdir) && \ - TESTDIR='$(CURDIR)' PATH="$(bindir):$$PATH" PGPORT='6$(DEF_PGPORT)' \ - top_builddir='$(top_builddir)' \ + TESTDIR='$(CURDIR)' PATH="$(bindir):$(CURDIR):$$PATH" \ + PGPORT='6$(DEF_PGPORT)' top_builddir='$(top_builddir)' \ PG_REGRESS='$(top_builddir)/src/test/regress/pg_regress' \ $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl) endef 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..7f648b19a2 100644 --- a/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl +++ b/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl @@ -14,9 +14,8 @@ $node->init; $node->start; my $numrows = 700; -my $libpq_pipeline = "$ENV{TESTDIR}/libpq_pipeline"; -my ($out, $err) = run_command([ $libpq_pipeline, 'tests' ]); +my ($out, $err) = run_command([ 'libpq_pipeline', 'tests' ]); die "oops: $err" unless $err eq ''; my @tests = split(/\s+/, $out); @@ -39,8 +38,8 @@ for my $testname (@tests) # Execute the test $node->command_ok( [ - $libpq_pipeline, @extraargs, - $testname, $node->connstr('postgres') + 'libpq_pipeline', @extraargs, + $testname, $node->connstr('postgres') ], "libpq_pipeline $testname"); diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl index 35e8f67f01..fc826da3ff 100644 --- a/src/tools/msvc/vcregress.pl +++ b/src/tools/msvc/vcregress.pl @@ -248,6 +248,9 @@ sub tap_check $ENV{REGRESS_SHLIB} = "$topdir/src/test/regress/regress.dll"; $ENV{TESTDIR} = "$dir"; + my $module = basename $dir; + # add the module build dir as the second element in the PATH + $ENV{PATH} =~ s!;!;$topdir/$Config/$module;!; rmtree('tmp_check'); system(@args); --------------EAFC9DC41E7A8ACFCB0537CC--