Skip to content

Commit b1907d6

Browse files
committed
Set application_name per-test in isolation and ecpg tests.
Commit a432729 taught pg_regress proper to do this, but missed the opportunity to do likewise in the isolationtester and ecpg variants of pg_regress. Seems like this might be helpful for tracking down issues exposed by those tests.
1 parent 458f01e commit b1907d6

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
char cmd[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
char expectfile[MAXPGPATH];
3737
char psql_cmd[MAXPGPATH * 3];
3838
size_t offset = 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
return pid;
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
static void
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)
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