Commit 061b88c7 authored by Robert Haas's avatar Robert Haas

Try again to make pg_isolation_regress work its build directory.

We can't search for the isolationtester binary until after we've set
up the environment, because otherwise when find_other_exec() tries
to invoke it with the -V option, it might fail for inability to
locate a working libpq.  So postpone that step.

Andres Freund
parent 9cab81b5
...@@ -12,7 +12,10 @@ ...@@ -12,7 +12,10 @@
#include "pg_regress.h" #include "pg_regress.h"
char saved_argv0[MAXPGPATH];
char isolation_exec[MAXPGPATH]; char isolation_exec[MAXPGPATH];
bool looked_up_isolation_exec = false;
#define PG_ISOLATION_VERSIONSTR "isolationtester (PostgreSQL) " PG_VERSION "\n" #define PG_ISOLATION_VERSIONSTR "isolationtester (PostgreSQL) " PG_VERSION "\n"
/* /*
...@@ -32,6 +35,19 @@ isolation_start_test(const char *testname, ...@@ -32,6 +35,19 @@ isolation_start_test(const char *testname,
char psql_cmd[MAXPGPATH * 3]; char psql_cmd[MAXPGPATH * 3];
size_t offset = 0; size_t offset = 0;
/* need to do the path lookup here, check isolation_init() for details */
if (!looked_up_isolation_exec)
{
/* look for isolationtester binary */
if (find_other_exec(saved_argv0, "isolationtester",
PG_ISOLATION_VERSIONSTR, isolation_exec) != 0)
{
fprintf(stderr, _("could not find proper isolationtester binary\n"));
exit(2);
}
looked_up_isolation_exec = true;
}
/* /*
* Look for files in the output dir first, consistent with a vpath search. * Look for files in the output dir first, consistent with a vpath search.
* This is mainly to create more reasonable error messages if the file is * This is mainly to create more reasonable error messages if the file is
...@@ -82,13 +98,16 @@ isolation_start_test(const char *testname, ...@@ -82,13 +98,16 @@ isolation_start_test(const char *testname,
static void static void
isolation_init(int argc, char **argv) isolation_init(int argc, char **argv)
{ {
/* look for isolationtester binary */ /*
if (find_other_exec(argv[0], "isolationtester", * We unfortunately cannot do the find_other_exec() lookup to find the
PG_ISOLATION_VERSIONSTR, isolation_exec) != 0) * "isolationtester" binary here. regression_main() calls the
{ * initialization functions before parsing the commandline arguments and
fprintf(stderr, _("could not find proper isolationtester binary\n")); * thus hasn't changed the library search path at this point which in turn
exit(2); * can cause the "isolationtester -V" invocation that find_other_exec()
} * does to fail since it's linked to libpq. So we instead copy argv[0]
* and do the lookup the first time through isolation_start_test().
*/
strncpy(saved_argv0, argv[0], MAXPGPATH);
/* set default regression database name */ /* set default regression database name */
add_stringlist_item(&dblist, "isolationtest"); add_stringlist_item(&dblist, "isolationtest");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment