Skip to content

Commit 061b88c

Browse files
committed
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
1 parent 9cab81b commit 061b88c

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

src/test/isolation/isolation_main.c

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212

1313
#include "pg_regress.h"
1414

15+
char saved_argv0[MAXPGPATH];
1516
char isolation_exec[MAXPGPATH];
17+
bool looked_up_isolation_exec = false;
18+
1619
#define PG_ISOLATION_VERSIONSTR "isolationtester (PostgreSQL) " PG_VERSION "\n"
1720

1821
/*
@@ -32,6 +35,19 @@ isolation_start_test(const char *testname,
3235
char psql_cmd[MAXPGPATH * 3];
3336
size_t offset = 0;
3437

38+
/* need to do the path lookup here, check isolation_init() for details */
39+
if (!looked_up_isolation_exec)
40+
{
41+
/* look for isolationtester binary */
42+
if (find_other_exec(saved_argv0, "isolationtester",
43+
PG_ISOLATION_VERSIONSTR, isolation_exec) != 0)
44+
{
45+
fprintf(stderr, _("could not find proper isolationtester binary\n"));
46+
exit(2);
47+
}
48+
looked_up_isolation_exec = true;
49+
}
50+
3551
/*
3652
* Look for files in the output dir first, consistent with a vpath search.
3753
* This is mainly to create more reasonable error messages if the file is
@@ -82,13 +98,16 @@ isolation_start_test(const char *testname,
8298
static void
8399
isolation_init(int argc, char **argv)
84100
{
85-
/* look for isolationtester binary */
86-
if (find_other_exec(argv[0], "isolationtester",
87-
PG_ISOLATION_VERSIONSTR, isolation_exec) != 0)
88-
{
89-
fprintf(stderr, _("could not find proper isolationtester binary\n"));
90-
exit(2);
91-
}
101+
/*
102+
* We unfortunately cannot do the find_other_exec() lookup to find the
103+
* "isolationtester" binary here. regression_main() calls the
104+
* initialization functions before parsing the commandline arguments and
105+
* thus hasn't changed the library search path at this point which in turn
106+
* can cause the "isolationtester -V" invocation that find_other_exec()
107+
* does to fail since it's linked to libpq. So we instead copy argv[0]
108+
* and do the lookup the first time through isolation_start_test().
109+
*/
110+
strncpy(saved_argv0, argv[0], MAXPGPATH);
92111

93112
/* set default regression database name */
94113
add_stringlist_item(&dblist, "isolationtest");

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy