mirror of
https://github.com/postgres/postgres.git
synced 2025-05-11 05:41:32 +03:00
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
This commit is contained in:
parent
07cacba983
commit
9b4d52f209
@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
#include "pg_regress.h"
|
#include "pg_regress.h"
|
||||||
|
|
||||||
|
char isolation_exec[MAXPGPATH];
|
||||||
|
#define PG_ISOLATION_VERSIONSTR "isolationtester (PostgreSQL) " PG_VERSION "\n"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* start an isolation tester process for specified file (including
|
* start an isolation tester process for specified file (including
|
||||||
* redirection), and return process ID
|
* redirection), and return process ID
|
||||||
@ -58,7 +61,8 @@ isolation_start_test(const char *testname,
|
|||||||
"%s ", launcher);
|
"%s ", launcher);
|
||||||
|
|
||||||
snprintf(psql_cmd + offset, sizeof(psql_cmd) - offset,
|
snprintf(psql_cmd + offset, sizeof(psql_cmd) - offset,
|
||||||
SYSTEMQUOTE "\"./isolationtester\" \"dbname=%s\" < \"%s\" > \"%s\" 2>&1" SYSTEMQUOTE,
|
SYSTEMQUOTE "\"%s\" \"dbname=%s\" < \"%s\" > \"%s\" 2>&1" SYSTEMQUOTE,
|
||||||
|
isolation_exec,
|
||||||
dblist->str,
|
dblist->str,
|
||||||
infile,
|
infile,
|
||||||
outfile);
|
outfile);
|
||||||
@ -76,8 +80,16 @@ isolation_start_test(const char *testname,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
isolation_init(void)
|
isolation_init(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
/* look for isolationtester binary */
|
||||||
|
if (find_other_exec(argv[0], "isolationtester",
|
||||||
|
PG_ISOLATION_VERSIONSTR, isolation_exec) != 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, _("could not find proper isolationtester binary\n"));
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
|
||||||
/* set default regression database name */
|
/* set default regression database name */
|
||||||
add_stringlist_item(&dblist, "isolationtest");
|
add_stringlist_item(&dblist, "isolationtest");
|
||||||
}
|
}
|
||||||
|
@ -85,13 +85,16 @@ main(int argc, char **argv)
|
|||||||
PQExpBufferData wait_query;
|
PQExpBufferData wait_query;
|
||||||
int opt;
|
int opt;
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "n")) != -1)
|
while ((opt = getopt(argc, argv, "nV")) != -1)
|
||||||
{
|
{
|
||||||
switch (opt)
|
switch (opt)
|
||||||
{
|
{
|
||||||
case 'n':
|
case 'n':
|
||||||
dry_run = true;
|
dry_run = true;
|
||||||
break;
|
break;
|
||||||
|
case 'V':
|
||||||
|
puts("isolationtester (PostgreSQL) " PG_VERSION);
|
||||||
|
exit(0);
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Usage: isolationtester [-n] [CONNINFO]\n");
|
fprintf(stderr, "Usage: isolationtester [-n] [CONNINFO]\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
@ -1955,7 +1955,7 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
|
|||||||
* We call the initialization function here because that way we can set
|
* We call the initialization function here because that way we can set
|
||||||
* default parameters and let them be overwritten by the commandline.
|
* default parameters and let them be overwritten by the commandline.
|
||||||
*/
|
*/
|
||||||
ifunc();
|
ifunc(argc, argv);
|
||||||
|
|
||||||
if (getenv("PG_REGRESS_DIFF_OPTS"))
|
if (getenv("PG_REGRESS_DIFF_OPTS"))
|
||||||
pretty_diff_opts = getenv("PG_REGRESS_DIFF_OPTS");
|
pretty_diff_opts = getenv("PG_REGRESS_DIFF_OPTS");
|
||||||
|
@ -30,7 +30,7 @@ typedef PID_TYPE(*test_function) (const char *,
|
|||||||
_stringlist **,
|
_stringlist **,
|
||||||
_stringlist **,
|
_stringlist **,
|
||||||
_stringlist **);
|
_stringlist **);
|
||||||
typedef void (*init_function) (void);
|
typedef void (*init_function) (int argc, char **argv);
|
||||||
|
|
||||||
extern char *bindir;
|
extern char *bindir;
|
||||||
extern char *libdir;
|
extern char *libdir;
|
||||||
|
@ -84,7 +84,7 @@ psql_start_test(const char *testname,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
psql_init(void)
|
psql_init(int argc, char **argv)
|
||||||
{
|
{
|
||||||
/* set default regression database name */
|
/* set default regression database name */
|
||||||
add_stringlist_item(&dblist, "regression");
|
add_stringlist_item(&dblist, "regression");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user