mirror of
https://github.com/postgres/postgres.git
synced 2025-05-06 19:59:18 +03:00
Set application_name per-test in isolation and ecpg tests.
Commit a4327296d 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.
This commit is contained in:
parent
458f01e254
commit
b1907d6882
@ -95,6 +95,7 @@ ecpg_start_test(const char *testname,
|
|||||||
expectfile_source[MAXPGPATH];
|
expectfile_source[MAXPGPATH];
|
||||||
char cmd[MAXPGPATH * 3];
|
char cmd[MAXPGPATH * 3];
|
||||||
char *testname_dash;
|
char *testname_dash;
|
||||||
|
char *appnameenv;
|
||||||
|
|
||||||
snprintf(inprg, sizeof(inprg), "%s/%s", inputdir, testname);
|
snprintf(inprg, sizeof(inprg), "%s/%s", inputdir, testname);
|
||||||
|
|
||||||
@ -144,6 +145,9 @@ ecpg_start_test(const char *testname,
|
|||||||
outfile_stdout,
|
outfile_stdout,
|
||||||
outfile_stderr);
|
outfile_stderr);
|
||||||
|
|
||||||
|
appnameenv = psprintf("PGAPPNAME=ecpg/%s", testname_dash);
|
||||||
|
putenv(appnameenv);
|
||||||
|
|
||||||
pid = spawn_process(cmd);
|
pid = spawn_process(cmd);
|
||||||
|
|
||||||
if (pid == INVALID_PID)
|
if (pid == INVALID_PID)
|
||||||
@ -153,6 +157,10 @@ ecpg_start_test(const char *testname,
|
|||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsetenv("PGAPPNAME");
|
||||||
|
free(appnameenv);
|
||||||
|
|
||||||
|
free(testname_dash);
|
||||||
free(outfile_stdout);
|
free(outfile_stdout);
|
||||||
free(outfile_stderr);
|
free(outfile_stderr);
|
||||||
free(outfile_source);
|
free(outfile_source);
|
||||||
|
@ -36,6 +36,7 @@ isolation_start_test(const char *testname,
|
|||||||
char expectfile[MAXPGPATH];
|
char expectfile[MAXPGPATH];
|
||||||
char psql_cmd[MAXPGPATH * 3];
|
char psql_cmd[MAXPGPATH * 3];
|
||||||
size_t offset = 0;
|
size_t offset = 0;
|
||||||
|
char *appnameenv;
|
||||||
|
|
||||||
/* need to do the path lookup here, check isolation_init() for details */
|
/* need to do the path lookup here, check isolation_init() for details */
|
||||||
if (!looked_up_isolation_exec)
|
if (!looked_up_isolation_exec)
|
||||||
@ -97,6 +98,9 @@ isolation_start_test(const char *testname,
|
|||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
appnameenv = psprintf("PGAPPNAME=isolation/%s", testname);
|
||||||
|
putenv(appnameenv);
|
||||||
|
|
||||||
pid = spawn_process(psql_cmd);
|
pid = spawn_process(psql_cmd);
|
||||||
|
|
||||||
if (pid == INVALID_PID)
|
if (pid == INVALID_PID)
|
||||||
@ -106,6 +110,9 @@ isolation_start_test(const char *testname,
|
|||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsetenv("PGAPPNAME");
|
||||||
|
free(appnameenv);
|
||||||
|
|
||||||
return pid;
|
return pid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -726,6 +726,10 @@ doputenv(const char *var, const char *val)
|
|||||||
static void
|
static void
|
||||||
initialize_environment(void)
|
initialize_environment(void)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* Set default application_name. (The test_function may choose to
|
||||||
|
* override this, but if it doesn't, we have something useful in place.)
|
||||||
|
*/
|
||||||
putenv("PGAPPNAME=pg_regress");
|
putenv("PGAPPNAME=pg_regress");
|
||||||
|
|
||||||
if (nolocale)
|
if (nolocale)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user