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

Commitb1907d6

Browse files
committed
Set application_name per-test in isolation and ecpg tests.
Commita432729 taught pg_regress proper to do this, butmissed the opportunity to do likewise in the isolationtesterand ecpg variants of pg_regress. Seems like this might behelpful for tracking down issues exposed by those tests.
1 parent458f01e commitb1907d6

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

‎src/interfaces/ecpg/test/pg_regress_ecpg.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ ecpg_start_test(const char *testname,
9595
expectfile_source[MAXPGPATH];
9696
charcmd[MAXPGPATH*3];
9797
char*testname_dash;
98+
char*appnameenv;
9899

99100
snprintf(inprg,sizeof(inprg),"%s/%s",inputdir,testname);
100101

@@ -144,6 +145,9 @@ ecpg_start_test(const char *testname,
144145
outfile_stdout,
145146
outfile_stderr);
146147

148+
appnameenv=psprintf("PGAPPNAME=ecpg/%s",testname_dash);
149+
putenv(appnameenv);
150+
147151
pid=spawn_process(cmd);
148152

149153
if (pid==INVALID_PID)
@@ -153,6 +157,10 @@ ecpg_start_test(const char *testname,
153157
exit(2);
154158
}
155159

160+
unsetenv("PGAPPNAME");
161+
free(appnameenv);
162+
163+
free(testname_dash);
156164
free(outfile_stdout);
157165
free(outfile_stderr);
158166
free(outfile_source);

‎src/test/isolation/isolation_main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ isolation_start_test(const char *testname,
3636
charexpectfile[MAXPGPATH];
3737
charpsql_cmd[MAXPGPATH*3];
3838
size_toffset=0;
39+
char*appnameenv;
3940

4041
/* need to do the path lookup here, check isolation_init() for details */
4142
if (!looked_up_isolation_exec)
@@ -97,6 +98,9 @@ isolation_start_test(const char *testname,
9798
exit(2);
9899
}
99100

101+
appnameenv=psprintf("PGAPPNAME=isolation/%s",testname);
102+
putenv(appnameenv);
103+
100104
pid=spawn_process(psql_cmd);
101105

102106
if (pid==INVALID_PID)
@@ -106,6 +110,9 @@ isolation_start_test(const char *testname,
106110
exit(2);
107111
}
108112

113+
unsetenv("PGAPPNAME");
114+
free(appnameenv);
115+
109116
returnpid;
110117
}
111118

‎src/test/regress/pg_regress.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,10 @@ doputenv(const char *var, const char *val)
726726
staticvoid
727727
initialize_environment(void)
728728
{
729+
/*
730+
* Set default application_name. (The test_function may choose to
731+
* override this, but if it doesn't, we have something useful in place.)
732+
*/
729733
putenv("PGAPPNAME=pg_regress");
730734

731735
if (nolocale)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp