Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9b4d52f

Browse files
committed
Fix pg_isolation_regress to work outside its build directory.
This makes it possible to, for example, use the isolation tester totest a contrib module.Andres Freund
1 parent07cacba commit9b4d52f

File tree

5 files changed

+21
-6
lines changed

5 files changed

+21
-6
lines changed

‎src/test/isolation/isolation_main.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#include"pg_regress.h"
1414

15+
charisolation_exec[MAXPGPATH];
16+
#definePG_ISOLATION_VERSIONSTR "isolationtester (PostgreSQL) " PG_VERSION "\n"
17+
1518
/*
1619
* start an isolation tester process for specified file (including
1720
* redirection), and return process ID
@@ -58,7 +61,8 @@ isolation_start_test(const char *testname,
5861
"%s ",launcher);
5962

6063
snprintf(psql_cmd+offset,sizeof(psql_cmd)-offset,
61-
SYSTEMQUOTE"\"./isolationtester\" \"dbname=%s\" < \"%s\" > \"%s\" 2>&1"SYSTEMQUOTE,
64+
SYSTEMQUOTE"\"%s\" \"dbname=%s\" < \"%s\" > \"%s\" 2>&1"SYSTEMQUOTE,
65+
isolation_exec,
6266
dblist->str,
6367
infile,
6468
outfile);
@@ -76,8 +80,16 @@ isolation_start_test(const char *testname,
7680
}
7781

7882
staticvoid
79-
isolation_init(void)
83+
isolation_init(intargc,char**argv)
8084
{
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+
}
92+
8193
/* set default regression database name */
8294
add_stringlist_item(&dblist,"isolationtest");
8395
}

‎src/test/isolation/isolationtester.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,16 @@ main(int argc, char **argv)
8585
PQExpBufferDatawait_query;
8686
intopt;
8787

88-
while ((opt=getopt(argc,argv,"n"))!=-1)
88+
while ((opt=getopt(argc,argv,"nV"))!=-1)
8989
{
9090
switch (opt)
9191
{
9292
case'n':
9393
dry_run= true;
9494
break;
95+
case'V':
96+
puts("isolationtester (PostgreSQL) "PG_VERSION);
97+
exit(0);
9598
default:
9699
fprintf(stderr,"Usage: isolationtester [-n] [CONNINFO]\n");
97100
returnEXIT_FAILURE;

‎src/test/regress/pg_regress.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1955,7 +1955,7 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
19551955
* We call the initialization function here because that way we can set
19561956
* default parameters and let them be overwritten by the commandline.
19571957
*/
1958-
ifunc();
1958+
ifunc(argc,argv);
19591959

19601960
if (getenv("PG_REGRESS_DIFF_OPTS"))
19611961
pretty_diff_opts=getenv("PG_REGRESS_DIFF_OPTS");

‎src/test/regress/pg_regress.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ typedef PID_TYPE(*test_function) (const char *,
3030
_stringlist**,
3131
_stringlist**,
3232
_stringlist**);
33-
typedefvoid (*init_function) (void);
33+
typedefvoid (*init_function) (intargc,char**argv);
3434

3535
externchar*bindir;
3636
externchar*libdir;

‎src/test/regress/pg_regress_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ psql_start_test(const char *testname,
8484
}
8585

8686
staticvoid
87-
psql_init(void)
87+
psql_init(intargc,char**argv)
8888
{
8989
/* set default regression database name */
9090
add_stringlist_item(&dblist,"regression");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp