pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Reference test binary using TESTDIR in 001_libpq_pipeline.pl.
15+ messages / 4 participants
[nested] [flat]
Commits from this thread:
2021-10-22 f4ce6c4d3a 52c0c11367 Add module build directory to the PATH for TAP tests
* pgsql: Reference test binary using TESTDIR in 001_libpq_pipeline.pl.
@ 2021-10-01 22:34 Andres Freund <andres@anarazel.de>
0 siblings, 1 reply; 15+ messages in thread
From: Andres Freund @ 2021-10-01 22:34 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
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 <andres@anarazel.de>
Suggested-By: Andrew Dunstan <andrew@dunslane.net>
Discussion: https://postgr.es/m/20210930214040.odkdd42vknvzifm6@alap3.anarazel.de
Backpatch: 14-, where the test was introduced.
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/795862c280c5949bafcd8c44543d887fd32b590a
Modified Files
--------------
src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
^ permalink raw reply [nested|flat] 15+ messages in thread
* pgsql: Reference test binary using TESTDIR in 001_libpq_pipeline.pl.
@ 2021-10-01 22:34 Andres Freund <andres@anarazel.de>
0 siblings, 0 replies; 15+ messages in thread
From: Andres Freund @ 2021-10-01 22:34 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
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 <andres@anarazel.de>
Suggested-By: Andrew Dunstan <andrew@dunslane.net>
Discussion: https://postgr.es/m/20210930214040.odkdd42vknvzifm6@alap3.anarazel.de
Backpatch: 14-, where the test was introduced.
Branch
------
REL_14_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/0baa33da0fd123aff215c505116dc60bc04dae90
Modified Files
--------------
src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: pgsql: Reference test binary using TESTDIR in 001_libpq_pipeline.pl.
@ 2021-10-08 15:41 Andrew Dunstan <andrew@dunslane.net>
parent: Andres Freund <andres@anarazel.de>
0 siblings, 2 replies; 15+ messages in thread
From: Andrew Dunstan @ 2021-10-08 15:41 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; pgsql-committers@lists.postgresql.org
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 <andres@anarazel.de>
> Suggested-By: Andrew Dunstan <andrew@dunslane.net>
> 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.
cheers
andrew
--
Andrew Dunstan
EDB: https://www.enterprisedb.com
Attachments:
libpg_pipeline_fix.patch (text/x-patch, 1.1K) download
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..7951600697 100644
--- a/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
+++ b/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
@@ -14,7 +14,15 @@ $node->init;
$node->start;
my $numrows = 700;
-my $libpq_pipeline = "$ENV{TESTDIR}/libpq_pipeline";
+my $libpq_pipeline;
+if (defined $ENV{MSBUILDDIR})
+{
+ $libpq_pipeline = "$ENV{MSBUILDDIR}/libpq_pipeline/libpq_pipeline.exe";
+}
+else
+{
+ $libpq_pipeline = "$ENV{TESTDIR}/libpq_pipeline";
+}
my ($out, $err) = run_command([ $libpq_pipeline, 'tests' ]);
die "oops: $err" unless $err eq '';
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})
{
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: pgsql: Reference test binary using TESTDIR in 001_libpq_pipeline.pl.
@ 2021-10-08 20:28 Andrew Dunstan <andrew@dunslane.net>
parent: Andrew Dunstan <andrew@dunslane.net>
1 sibling, 0 replies; 15+ messages in thread
From: Andrew Dunstan @ 2021-10-08 20:28 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; pgsql-committers@lists.postgresql.org
On 10/8/21 11:41 AM, 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 <andres@anarazel.de>
>> Suggested-By: Andrew Dunstan <andrew@dunslane.net>
>> 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.
>
>
Confirmed that this makes the test pass.
cheers
andrew
--
Andrew Dunstan
EDB: https://www.enterprisedb.com
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: pgsql: Reference test binary using TESTDIR in 001_libpq_pipeline.pl.
@ 2021-10-08 21:14 Andres Freund <andres@anarazel.de>
parent: Andrew Dunstan <andrew@dunslane.net>
1 sibling, 1 reply; 15+ messages in thread
From: Andres Freund @ 2021-10-08 21:14 UTC (permalink / raw)
To: Andrew Dunstan <andrew@dunslane.net>; +Cc: pgsql-committers@lists.postgresql.org
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 <andres@anarazel.de>
> > Suggested-By: Andrew Dunstan <andrew@dunslane.net>
> > 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?
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: pgsql: Reference test binary using TESTDIR in 001_libpq_pipeline.pl.
@ 2021-10-09 00:33 Andrew Dunstan <andrew@dunslane.net>
parent: Andres Freund <andres@anarazel.de>
0 siblings, 1 reply; 15+ messages in thread
From: Andrew Dunstan @ 2021-10-09 00:33 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: pgsql-committers@lists.postgresql.org
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 <andres@anarazel.de>
>>> Suggested-By: Andrew Dunstan <andrew@dunslane.net>
>>> 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.
cheers
andrew
--
Andrew Dunstan
EDB: https://www.enterprisedb.com
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: pgsql: Reference test binary using TESTDIR in 001_libpq_pipeline.pl.
@ 2021-10-17 16:01 Andrew Dunstan <andrew@dunslane.net>
parent: Andrew Dunstan <andrew@dunslane.net>
0 siblings, 1 reply; 15+ messages in thread
From: Andrew Dunstan @ 2021-10-17 16:01 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: pgsql-committers@lists.postgresql.org
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 <andres@anarazel.de>
>>>> Suggested-By: Andrew Dunstan <andrew@dunslane.net>
>>>> 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
Attachments:
libpq_pipeline_fix.patch (text/x-patch, 2.1K) download
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<program_name>: 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})
{
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: pgsql: Reference test binary using TESTDIR in 001_libpq_pipeline.pl.
@ 2021-10-18 14:23 Alvaro Herrera <alvherre@alvh.no-ip.org>
parent: Andrew Dunstan <andrew@dunslane.net>
0 siblings, 1 reply; 15+ messages in thread
From: Alvaro Herrera @ 2021-10-18 14:23 UTC (permalink / raw)
To: Andrew Dunstan <andrew@dunslane.net>; +Cc: Andres Freund <andres@anarazel.de>; pgsql-committers@lists.postgresql.org
On 2021-Oct-17, Andrew Dunstan wrote:
> +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});
> + }
Hmm, it seems weird to have to use File::Find when we already know where
the program is, right? I mean, per your previous patch, we know that
the program is in $MSBUILDDIR/libpq_pipeline/libpq_pipeline.exe, so why
don't we make this one be
if (defined $ENV{MSBUILDDIR})
{
return $ENV{MSBUILDDIR} . "$program/$program.exe";
}
?
I noticed that drongo is still red, and reporting that no tests are
being run. While this makes sense (because the list of tests is
obtained by running libpq_pipeline), I am surprised that this isn't
reported as such. I would have expected it to die with an error message
starting with "oops: " ... did run_command() fail to return stderr?
... oh, run_command() seems a bit too optimistic: it doesn't check
whether IPC::Run::run() failed. I think that's worth fixing
independently.
--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
Subversion to GIT: the shortest path to happiness I've ever heard of
(Alexey Klyukin)
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: pgsql: Reference test binary using TESTDIR in 001_libpq_pipeline.pl.
@ 2021-10-18 15:39 Andrew Dunstan <andrew@dunslane.net>
parent: Alvaro Herrera <alvherre@alvh.no-ip.org>
0 siblings, 1 reply; 15+ messages in thread
From: Andrew Dunstan @ 2021-10-18 15:39 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: Andres Freund <andres@anarazel.de>; pgsql-committers@lists.postgresql.org
On 10/18/21 10:23 AM, Alvaro Herrera wrote:
> On 2021-Oct-17, Andrew Dunstan wrote:
>
>> +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});
>> + }
> Hmm, it seems weird to have to use File::Find when we already know where
> the program is, right? I mean, per your previous patch, we know that
> the program is in $MSBUILDDIR/libpq_pipeline/libpq_pipeline.exe, so why
> don't we make this one be
>
> if (defined $ENV{MSBUILDDIR})
> {
> return $ENV{MSBUILDDIR} . "$program/$program.exe";
> }
Could do, but say the module had two programs? Mostly we don't do that
but Release/pg_isolation_regress has two executables, so it's more than
just theoretically possible.
File::Find on the build directory is likely to be fairly quick, but a
simpler way might be to use glob expansion:
maybe something like:
my @progs = glob("$ENV{MSBUILDDIR}/*/$program.exe");
plus some logic to disambiguate any duplicates.
>
> ?
>
> I noticed that drongo is still red, and reporting that no tests are
> being run. While this makes sense (because the list of tests is
> obtained by running libpq_pipeline), I am surprised that this isn't
> reported as such. I would have expected it to die with an error message
> starting with "oops: " ... did run_command() fail to return stderr?
>
> ... oh, run_command() seems a bit too optimistic: it doesn't check
> whether IPC::Run::run() failed. I think that's worth fixing
> independently.
>
Yeah.
cheers
andrew
--
Andrew Dunstan
EDB: https://www.enterprisedb.com
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: pgsql: Reference test binary using TESTDIR in 001_libpq_pipeline.pl.
@ 2021-10-20 16:31 Andres Freund <andres@anarazel.de>
parent: Andrew Dunstan <andrew@dunslane.net>
0 siblings, 1 reply; 15+ messages in thread
From: Andres Freund @ 2021-10-20 16:31 UTC (permalink / raw)
To: Andrew Dunstan <andrew@dunslane.net>; +Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-committers@lists.postgresql.org
Hi,
On 2021-10-18 11:39:08 -0400, Andrew Dunstan wrote:
> On 10/18/21 10:23 AM, Alvaro Herrera wrote:
> > On 2021-Oct-17, Andrew Dunstan wrote:
> >
> >> +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});
> >> + }
> > Hmm, it seems weird to have to use File::Find when we already know where
> > the program is, right? I mean, per your previous patch, we know that
> > the program is in $MSBUILDDIR/libpq_pipeline/libpq_pipeline.exe, so why
> > don't we make this one be
> >
> > if (defined $ENV{MSBUILDDIR})
> > {
> > return $ENV{MSBUILDDIR} . "$program/$program.exe";
> > }
>
>
> Could do, but say the module had two programs? Mostly we don't do that
> but Release/pg_isolation_regress has two executables, so it's more than
> just theoretically possible.
ISTM that we should just make the "test invocation framework" responsible to
put the relevant directory onto PATH? I.e. Makefile.global should add the
build directory of the test to PATH, and vcregress.pl should put the relevant
$configuration/$project/ directory there?
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: pgsql: Reference test binary using TESTDIR in 001_libpq_pipeline.pl.
@ 2021-10-20 18:30 Andrew Dunstan <andrew@dunslane.net>
parent: Andres Freund <andres@anarazel.de>
0 siblings, 1 reply; 15+ messages in thread
From: Andrew Dunstan @ 2021-10-20 18:30 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-committers@lists.postgresql.org
On 10/20/21 12:31 PM, Andres Freund wrote:
>
> ISTM that we should just make the "test invocation framework" responsible to
> put the relevant directory onto PATH? I.e. Makefile.global should add the
> build directory of the test to PATH, and vcregress.pl should put the relevant
> $configuration/$project/ directory there?
>
Like this? That seems reasonable.
cheers
andrew
--
Andrew Dunstan
EDB: https://www.enterprisedb.com
Attachments:
libpq_pipeline_fix3.patch (text/x-patch, 1.7K) download
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index a1da1ea4ee..2f6b7ad561 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -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="$(CURDIR):$(bindir):$$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
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..d1d321ff8f 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);
diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl
index 35e8f67f01..785d908edd 100644
--- a/src/tools/msvc/vcregress.pl
+++ b/src/tools/msvc/vcregress.pl
@@ -248,6 +248,8 @@ sub tap_check
$ENV{REGRESS_SHLIB} = "$topdir/src/test/regress/regress.dll";
$ENV{TESTDIR} = "$dir";
+ my $module = basename $dir;
+ $ENV{PATH} = "$topdir/$Config/$module;$ENV{PATH}";
rmtree('tmp_check');
system(@args);
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: pgsql: Reference test binary using TESTDIR in 001_libpq_pipeline.pl.
@ 2021-10-20 19:09 Andres Freund <andres@anarazel.de>
parent: Andrew Dunstan <andrew@dunslane.net>
0 siblings, 1 reply; 15+ messages in thread
From: Andres Freund @ 2021-10-20 19:09 UTC (permalink / raw)
To: Andrew Dunstan <andrew@dunslane.net>; +Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-committers@lists.postgresql.org
Hi,
On 2021-10-20 14:30:49 -0400, Andrew Dunstan wrote:
> On 10/20/21 12:31 PM, Andres Freund wrote:
> > ISTM that we should just make the "test invocation framework" responsible to
> > put the relevant directory onto PATH? I.e. Makefile.global should add the
> > build directory of the test to PATH, and vcregress.pl should put the relevant
> > $configuration/$project/ directory there?
> Like this? That seems reasonable.
Yea, that's along the lines of what I was thinking...
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: pgsql: Reference test binary using TESTDIR in 001_libpq_pipeline.pl.
@ 2021-10-20 21:27 Andrew Dunstan <andrew@dunslane.net>
parent: Andres Freund <andres@anarazel.de>
0 siblings, 1 reply; 15+ messages in thread
From: Andrew Dunstan @ 2021-10-20 21:27 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-committers@lists.postgresql.org
On 10/20/21 3:09 PM, Andres Freund wrote:
> Hi,
>
> On 2021-10-20 14:30:49 -0400, Andrew Dunstan wrote:
>> On 10/20/21 12:31 PM, Andres Freund wrote:
>>> ISTM that we should just make the "test invocation framework" responsible to
>>> put the relevant directory onto PATH? I.e. Makefile.global should add the
>>> build directory of the test to PATH, and vcregress.pl should put the relevant
>>> $configuration/$project/ directory there?
>> Like this? That seems reasonable.
> Yea, that's along the lines of what I was thinking...
>
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.
This patch has been tested on Linux but not yet on Windows/MSVC,
although I have little doubt it will work there too.
cheers
andrew
--
Andrew Dunstan
EDB: https://www.enterprisedb.com
Attachments:
libpq_pipeline_fix4.patch (text/x-patch, 2.9K) download
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index a1da1ea4ee..5ff5c0c1a1 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):$$PATH:$(CURDIR)" \
$(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):$$PATH:$(CURDIR)" \
+ 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):$$PATH:$(CURDIR)" \
+ 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..2ed8de4aad 100644
--- a/src/tools/msvc/vcregress.pl
+++ b/src/tools/msvc/vcregress.pl
@@ -248,6 +248,8 @@ sub tap_check
$ENV{REGRESS_SHLIB} = "$topdir/src/test/regress/regress.dll";
$ENV{TESTDIR} = "$dir";
+ my $module = basename $dir;
+ $ENV{PATH} = "$ENV{PATH};$topdir/$Config/$module";
rmtree('tmp_check');
system(@args);
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: pgsql: Reference test binary using TESTDIR in 001_libpq_pipeline.pl.
@ 2021-10-20 21:48 Tom Lane <tgl@sss.pgh.pa.us>
parent: Andrew Dunstan <andrew@dunslane.net>
0 siblings, 1 reply; 15+ messages in thread
From: Tom Lane @ 2021-10-20 21:48 UTC (permalink / raw)
To: Andrew Dunstan <andrew@dunslane.net>; +Cc: Andres Freund <andres@anarazel.de>; Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-committers@lists.postgresql.org
Andrew Dunstan <andrew@dunslane.net> 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"
regards, tom lane
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: pgsql: Reference test binary using TESTDIR in 001_libpq_pipeline.pl.
@ 2021-10-21 20:55 Andrew Dunstan <andrew@dunslane.net>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 15+ messages in thread
From: Andrew Dunstan @ 2021-10-21 20:55 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Andres Freund <andres@anarazel.de>; Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-committers@lists.postgresql.org
On 10/20/21 5:48 PM, Tom Lane wrote:
> Andrew Dunstan <andrew@dunslane.net> 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
Attachments:
libpq_pipeline_fix5.patch (text/x-patch, 3.0K) download
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);
^ permalink raw reply [nested|flat] 15+ messages in thread
end of thread, other threads:[~2021-10-21 20:55 UTC | newest]
Thread overview: 15+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-10-01 22:34 pgsql: Reference test binary using TESTDIR in 001_libpq_pipeline.pl. Andres Freund <andres@anarazel.de>
2021-10-08 15:41 ` Andrew Dunstan <andrew@dunslane.net>
2021-10-08 20:28 ` Andrew Dunstan <andrew@dunslane.net>
2021-10-08 21:14 ` Andres Freund <andres@anarazel.de>
2021-10-09 00:33 ` Andrew Dunstan <andrew@dunslane.net>
2021-10-17 16:01 ` Andrew Dunstan <andrew@dunslane.net>
2021-10-18 14:23 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2021-10-18 15:39 ` Andrew Dunstan <andrew@dunslane.net>
2021-10-20 16:31 ` Andres Freund <andres@anarazel.de>
2021-10-20 18:30 ` Andrew Dunstan <andrew@dunslane.net>
2021-10-20 19:09 ` Andres Freund <andres@anarazel.de>
2021-10-20 21:27 ` Andrew Dunstan <andrew@dunslane.net>
2021-10-20 21:48 ` Tom Lane <tgl@sss.pgh.pa.us>
2021-10-21 20:55 ` Andrew Dunstan <andrew@dunslane.net>
2021-10-01 22:34 pgsql: Reference test binary using TESTDIR in 001_libpq_pipeline.pl. Andres Freund <andres@anarazel.de>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox