#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
* redirection), and return process ID
"%s ", launcher);
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,
infile,
outfile);
}
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 */
add_stringlist_item(&dblist, "isolationtest");
}
PQExpBufferData wait_query;
int opt;
- while ((opt = getopt(argc, argv, "n")) != -1)
+ while ((opt = getopt(argc, argv, "nV")) != -1)
{
switch (opt)
{
case 'n':
dry_run = true;
break;
+ case 'V':
+ puts("isolationtester (PostgreSQL) " PG_VERSION);
+ exit(0);
default:
fprintf(stderr, "Usage: isolationtester [-n] [CONNINFO]\n");
return EXIT_FAILURE;
* We call the initialization function here because that way we can set
* default parameters and let them be overwritten by the commandline.
*/
- ifunc();
+ ifunc(argc, argv);
if (getenv("PG_REGRESS_DIFF_OPTS"))
pretty_diff_opts = getenv("PG_REGRESS_DIFF_OPTS");
}
static void
-psql_init(void)
+psql_init(int argc, char **argv)
{
/* set default regression database name */
add_stringlist_item(&dblist, "regression");