Re: [COMMITTERS] pgsql: Fix pg_isolation_regress to work outside its build directory.

Lists: pgsql-committerspgsql-hackers
From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix pg_isolation_regress to work outside its build directory.
Date: 2013-11-08 20:02:30
Message-ID: E1VesGE-0007vF-0X@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Fix pg_isolation_regress to work outside its build directory.

This makes it possible to, for example, use the isolation tester to
test a contrib module.

Andres Freund

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/9b4d52f2095be96ca238ce41f6963ec56376491f

Modified Files
--------------
src/test/isolation/isolation_main.c | 16 ++++++++++++++--
src/test/isolation/isolationtester.c | 5 ++++-
src/test/regress/pg_regress.c | 2 +-
src/test/regress/pg_regress.h | 2 +-
src/test/regress/pg_regress_main.c | 2 +-
5 files changed, 21 insertions(+), 6 deletions(-)


From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Robert Haas <rhaas(at)postgresql(dot)org>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Fix pg_isolation_regress to work outside its build directory.
Date: 2013-11-09 14:13:14
Message-ID: 20131109141314.GA25959@alap2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Hi,

On 2013-11-08 20:02:30 +0000, Robert Haas wrote:
> Fix pg_isolation_regress to work outside its build directory.

> This makes it possible to, for example, use the isolation tester to
> test a contrib module.

Unfortunately this isn't working all that well on anole and currawong :/.
Looking at the output on the former the reason becomes clear:
./pg_isolation_regress --temp-install=./tmp_check --inputdir=. --top-builddir=../../.. --schedule=./isolation_schedule
/usr/lib/hpux64/dld.so: Unable to find library 'libpq.so.5'.
sh: 15000 Killed

isolationtester doesn't find libpq during find_other_exec(). I think that is because it normally
only gets run when pg_regress.c has done:
/*
* Set up shared library paths to include the temp install.
*
* LD_LIBRARY_PATH covers many platforms. DYLD_LIBRARY_PATH works on
* Darwin, and maybe other Mach-based systems. LIBPATH is for AIX.
* Windows needs shared libraries in PATH (only those linked into
* executables, not dlopen'ed ones). Feel free to account for others
* as well.
*/
add_to_path("LD_LIBRARY_PATH", ':', libdir);
add_to_path("DYLD_LIBRARY_PATH", ':', libdir);
add_to_path("LIBPATH", ':', libdir);
#if defined(WIN32)
add_to_path("PATH", ';', libdir);
#elif defined(__CYGWIN__)
add_to_path("PATH", ':', libdir);
#endif

but the initialization functions are run earlier:
/*
* We call the initialization function here because that way we can set
* default parameters and let them be overwritten by the commandline.
*/
ifunc(argc, argv);

The only hack I currently can think of is to store argv[0] in a global
variable and to run the find_other_exec() in the first run through
isolation_start_test() :/.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Robert Haas <rhaas(at)postgresql(dot)org>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Fix pg_isolation_regress to work outside its build directory.
Date: 2013-11-12 12:05:38
Message-ID: 20131112120538.GA23777@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

On 2013-11-09 15:13:14 +0100, Andres Freund wrote:
> Hi,
>
> On 2013-11-08 20:02:30 +0000, Robert Haas wrote:
> > Fix pg_isolation_regress to work outside its build directory.
>
> > This makes it possible to, for example, use the isolation tester to
> > test a contrib module.
>
> Unfortunately this isn't working all that well on anole and currawong :/.
> Looking at the output on the former the reason becomes clear:
> ./pg_isolation_regress --temp-install=./tmp_check --inputdir=. --top-builddir=../../.. --schedule=./isolation_schedule
> /usr/lib/hpux64/dld.so: Unable to find library 'libpq.so.5'.
> sh: 15000 Killed
>
> isolationtester doesn't find libpq during find_other_exec(). I think that is because it normally
> only gets run when pg_regress.c has done:
> /*
> * Set up shared library paths to include the temp install.
> *
> * LD_LIBRARY_PATH covers many platforms. DYLD_LIBRARY_PATH works on
> * Darwin, and maybe other Mach-based systems. LIBPATH is for AIX.
> * Windows needs shared libraries in PATH (only those linked into
> * executables, not dlopen'ed ones). Feel free to account for others
> * as well.
> */
> add_to_path("LD_LIBRARY_PATH", ':', libdir);
> add_to_path("DYLD_LIBRARY_PATH", ':', libdir);
> add_to_path("LIBPATH", ':', libdir);
> #if defined(WIN32)
> add_to_path("PATH", ';', libdir);
> #elif defined(__CYGWIN__)
> add_to_path("PATH", ':', libdir);
> #endif
>
> but the initialization functions are run earlier:
> /*
> * We call the initialization function here because that way we can set
> * default parameters and let them be overwritten by the commandline.
> */
> ifunc(argc, argv);
>
> The only hack I currently can think of is to store argv[0] in a global
> variable and to run the find_other_exec() in the first run through
> isolation_start_test() :/.

A patch to that end attached.

Alternatively we could add a "startup_function startup" argument to
regression_main() that's called later, when the environment is setup.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
0001-Fix-pg_isolation_regress-to-find_other_exec-after-en.patch text/x-patch 3.0 KB

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Robert Haas <rhaas(at)postgresql(dot)org>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Fix pg_isolation_regress to work outside its build directory.
Date: 2013-11-12 16:29:50
Message-ID: CA+TgmoaVjLMe0e+Qi-aR3LsOKn2zJY2s8PgmoeD5kaL-uO6Fcg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

On Tue, Nov 12, 2013 at 7:05 AM, Andres Freund <andres(at)2ndquadrant(dot)com> wrote:
>> The only hack I currently can think of is to store argv[0] in a global
>> variable and to run the find_other_exec() in the first run through
>> isolation_start_test() :/.
>
> A patch to that end attached.
>
> Alternatively we could add a "startup_function startup" argument to
> regression_main() that's called later, when the environment is setup.

That might be a better long-term solution, although I'll defer to the
opinions of people who have worked on this code more than I have. But
I've committed this for now, in the hopes of making the buildfarm
green again.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company