mirror of
https://github.com/postgres/postgres.git
synced 2025-06-01 00:01:20 -04:00
pg_regress: Replace exit_nicely() with exit() plus atexit() hook
This commit is contained in:
parent
ac7a5a3f25
commit
bd09111f1f
@ -34,13 +34,13 @@ ecpg_filter(const char *sourcefile, const char *outfile)
|
|||||||
if (!s)
|
if (!s)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Could not open file %s for reading\n", sourcefile);
|
fprintf(stderr, "Could not open file %s for reading\n", sourcefile);
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
t = fopen(outfile, "w");
|
t = fopen(outfile, "w");
|
||||||
if (!t)
|
if (!t)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Could not open file %s for writing\n", outfile);
|
fprintf(stderr, "Could not open file %s for writing\n", outfile);
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (fgets(linebuf, LINEBUFSIZE, s))
|
while (fgets(linebuf, LINEBUFSIZE, s))
|
||||||
@ -148,7 +148,7 @@ ecpg_start_test(const char *testname,
|
|||||||
{
|
{
|
||||||
fprintf(stderr, _("could not start process for test %s\n"),
|
fprintf(stderr, _("could not start process for test %s\n"),
|
||||||
testname);
|
testname);
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(outfile_stdout);
|
free(outfile_stdout);
|
||||||
|
@ -300,24 +300,13 @@ stop_postmaster(void)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, _("\n%s: could not stop postmaster: exit code was %d\n"),
|
fprintf(stderr, _("\n%s: could not stop postmaster: exit code was %d\n"),
|
||||||
progname, r);
|
progname, r);
|
||||||
exit(2); /* not exit_nicely(), that would be recursive */
|
_exit(2); /* not exit(), that could be recursive */
|
||||||
}
|
}
|
||||||
|
|
||||||
postmaster_running = false;
|
postmaster_running = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Always exit through here, not through plain exit(), to ensure we make
|
|
||||||
* an effort to shut down a temp postmaster
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
exit_nicely(int code)
|
|
||||||
{
|
|
||||||
stop_postmaster();
|
|
||||||
exit(code);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check whether string matches pattern
|
* Check whether string matches pattern
|
||||||
*
|
*
|
||||||
@ -444,7 +433,7 @@ convert_sourcefiles_in(char *source_subdir, char *dest_subdir, char *suffix)
|
|||||||
names = pgfnames(indir);
|
names = pgfnames(indir);
|
||||||
if (!names)
|
if (!names)
|
||||||
/* Error logged in pgfnames */
|
/* Error logged in pgfnames */
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
|
|
||||||
snprintf(testtablespace, MAXPGPATH, "%s/testtablespace", outputdir);
|
snprintf(testtablespace, MAXPGPATH, "%s/testtablespace", outputdir);
|
||||||
|
|
||||||
@ -493,14 +482,14 @@ convert_sourcefiles_in(char *source_subdir, char *dest_subdir, char *suffix)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, _("%s: could not open file \"%s\" for reading: %s\n"),
|
fprintf(stderr, _("%s: could not open file \"%s\" for reading: %s\n"),
|
||||||
progname, srcfile, strerror(errno));
|
progname, srcfile, strerror(errno));
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
outfile = fopen(destfile, "w");
|
outfile = fopen(destfile, "w");
|
||||||
if (!outfile)
|
if (!outfile)
|
||||||
{
|
{
|
||||||
fprintf(stderr, _("%s: could not open file \"%s\" for writing: %s\n"),
|
fprintf(stderr, _("%s: could not open file \"%s\" for writing: %s\n"),
|
||||||
progname, destfile, strerror(errno));
|
progname, destfile, strerror(errno));
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
while (fgets(line, sizeof(line), infile))
|
while (fgets(line, sizeof(line), infile))
|
||||||
{
|
{
|
||||||
@ -523,7 +512,7 @@ convert_sourcefiles_in(char *source_subdir, char *dest_subdir, char *suffix)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, _("%s: no *.source files found in \"%s\"\n"),
|
fprintf(stderr, _("%s: no *.source files found in \"%s\"\n"),
|
||||||
progname, indir);
|
progname, indir);
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
pgfnames_cleanup(names);
|
pgfnames_cleanup(names);
|
||||||
@ -566,7 +555,7 @@ load_resultmap(void)
|
|||||||
return;
|
return;
|
||||||
fprintf(stderr, _("%s: could not open file \"%s\" for reading: %s\n"),
|
fprintf(stderr, _("%s: could not open file \"%s\" for reading: %s\n"),
|
||||||
progname, buf, strerror(errno));
|
progname, buf, strerror(errno));
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (fgets(buf, sizeof(buf), f))
|
while (fgets(buf, sizeof(buf), f))
|
||||||
@ -587,7 +576,7 @@ load_resultmap(void)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, _("incorrectly formatted resultmap entry: %s\n"),
|
fprintf(stderr, _("incorrectly formatted resultmap entry: %s\n"),
|
||||||
buf);
|
buf);
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
*file_type++ = '\0';
|
*file_type++ = '\0';
|
||||||
|
|
||||||
@ -596,7 +585,7 @@ load_resultmap(void)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, _("incorrectly formatted resultmap entry: %s\n"),
|
fprintf(stderr, _("incorrectly formatted resultmap entry: %s\n"),
|
||||||
buf);
|
buf);
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
*platform++ = '\0';
|
*platform++ = '\0';
|
||||||
expected = strchr(platform, '=');
|
expected = strchr(platform, '=');
|
||||||
@ -604,7 +593,7 @@ load_resultmap(void)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, _("incorrectly formatted resultmap entry: %s\n"),
|
fprintf(stderr, _("incorrectly formatted resultmap entry: %s\n"),
|
||||||
buf);
|
buf);
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
*expected++ = '\0';
|
*expected++ = '\0';
|
||||||
|
|
||||||
@ -916,7 +905,7 @@ psql_command(const char *database, const char *query,...)
|
|||||||
{
|
{
|
||||||
/* psql probably already reported the error */
|
/* psql probably already reported the error */
|
||||||
fprintf(stderr, _("command failed: %s\n"), psql_cmd);
|
fprintf(stderr, _("command failed: %s\n"), psql_cmd);
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -945,7 +934,7 @@ spawn_process(const char *cmdline)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, _("%s: could not fork: %s\n"),
|
fprintf(stderr, _("%s: could not fork: %s\n"),
|
||||||
progname, strerror(errno));
|
progname, strerror(errno));
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
if (pid == 0)
|
if (pid == 0)
|
||||||
{
|
{
|
||||||
@ -962,7 +951,7 @@ spawn_process(const char *cmdline)
|
|||||||
execl(shellprog, shellprog, "-c", cmdline2, (char *) NULL);
|
execl(shellprog, shellprog, "-c", cmdline2, (char *) NULL);
|
||||||
fprintf(stderr, _("%s: could not exec \"%s\": %s\n"),
|
fprintf(stderr, _("%s: could not exec \"%s\": %s\n"),
|
||||||
progname, shellprog, strerror(errno));
|
progname, shellprog, strerror(errno));
|
||||||
exit(1); /* not exit_nicely here... */
|
_exit(1); /* not exit() here... */
|
||||||
}
|
}
|
||||||
/* in parent */
|
/* in parent */
|
||||||
return pid;
|
return pid;
|
||||||
@ -993,7 +982,7 @@ spawn_process(const char *cmdline)
|
|||||||
FreeLibrary(Advapi32Handle);
|
FreeLibrary(Advapi32Handle);
|
||||||
fprintf(stderr, _("%s: cannot create restricted tokens on this platform\n"),
|
fprintf(stderr, _("%s: cannot create restricted tokens on this platform\n"),
|
||||||
progname);
|
progname);
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open the current token to use as base for the restricted one */
|
/* Open the current token to use as base for the restricted one */
|
||||||
@ -1001,7 +990,7 @@ spawn_process(const char *cmdline)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, _("could not open process token: error code %lu\n"),
|
fprintf(stderr, _("could not open process token: error code %lu\n"),
|
||||||
GetLastError());
|
GetLastError());
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate list of SIDs to remove */
|
/* Allocate list of SIDs to remove */
|
||||||
@ -1012,7 +1001,7 @@ spawn_process(const char *cmdline)
|
|||||||
SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_POWER_USERS, 0, 0, 0, 0, 0, 0, &dropSids[1].Sid))
|
SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_POWER_USERS, 0, 0, 0, 0, 0, 0, &dropSids[1].Sid))
|
||||||
{
|
{
|
||||||
fprintf(stderr, _("could not allocate SIDs: error code %lu\n"), GetLastError());
|
fprintf(stderr, _("could not allocate SIDs: error code %lu\n"), GetLastError());
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
b = _CreateRestrictedToken(origToken,
|
b = _CreateRestrictedToken(origToken,
|
||||||
@ -1032,7 +1021,7 @@ spawn_process(const char *cmdline)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, _("could not create restricted token: error code %lu\n"),
|
fprintf(stderr, _("could not create restricted token: error code %lu\n"),
|
||||||
GetLastError());
|
GetLastError());
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdline2 = malloc(strlen(cmdline) + 8);
|
cmdline2 = malloc(strlen(cmdline) + 8);
|
||||||
@ -1056,7 +1045,7 @@ spawn_process(const char *cmdline)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, _("could not start process for \"%s\": error code %lu\n"),
|
fprintf(stderr, _("could not start process for \"%s\": error code %lu\n"),
|
||||||
cmdline2, GetLastError());
|
cmdline2, GetLastError());
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(cmdline2);
|
free(cmdline2);
|
||||||
@ -1144,7 +1133,7 @@ make_directory(const char *dir)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, _("%s: could not create directory \"%s\": %s\n"),
|
fprintf(stderr, _("%s: could not create directory \"%s\": %s\n"),
|
||||||
progname, dir, strerror(errno));
|
progname, dir, strerror(errno));
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1185,7 +1174,7 @@ run_diff(const char *cmd, const char *filename)
|
|||||||
if (!WIFEXITED(r) || WEXITSTATUS(r) > 1)
|
if (!WIFEXITED(r) || WEXITSTATUS(r) > 1)
|
||||||
{
|
{
|
||||||
fprintf(stderr, _("diff command failed with status %d: %s\n"), r, cmd);
|
fprintf(stderr, _("diff command failed with status %d: %s\n"), r, cmd);
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|
||||||
@ -1196,7 +1185,7 @@ run_diff(const char *cmd, const char *filename)
|
|||||||
if (WEXITSTATUS(r) == 1 && file_size(filename) <= 0)
|
if (WEXITSTATUS(r) == 1 && file_size(filename) <= 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, _("diff command not found: %s\n"), cmd);
|
fprintf(stderr, _("diff command not found: %s\n"), cmd);
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1371,7 +1360,7 @@ wait_for_tests(PID_TYPE * pids, int *statuses, char **names, int num_tests)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, _("failed to wait for subprocesses: %s\n"),
|
fprintf(stderr, _("failed to wait for subprocesses: %s\n"),
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
DWORD exit_status;
|
DWORD exit_status;
|
||||||
@ -1382,7 +1371,7 @@ wait_for_tests(PID_TYPE * pids, int *statuses, char **names, int num_tests)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, _("failed to wait for subprocesses: error code %lu\n"),
|
fprintf(stderr, _("failed to wait for subprocesses: error code %lu\n"),
|
||||||
GetLastError());
|
GetLastError());
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
p = active_pids[r - WAIT_OBJECT_0];
|
p = active_pids[r - WAIT_OBJECT_0];
|
||||||
/* compact the active_pids array */
|
/* compact the active_pids array */
|
||||||
@ -1468,7 +1457,7 @@ run_schedule(const char *schedule, test_function tfunc)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, _("%s: could not open file \"%s\" for reading: %s\n"),
|
fprintf(stderr, _("%s: could not open file \"%s\" for reading: %s\n"),
|
||||||
progname, schedule, strerror(errno));
|
progname, schedule, strerror(errno));
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (fgets(scbuf, sizeof(scbuf), scf))
|
while (fgets(scbuf, sizeof(scbuf), scf))
|
||||||
@ -1517,7 +1506,7 @@ run_schedule(const char *schedule, test_function tfunc)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, _("syntax error in schedule file \"%s\" line %d: %s\n"),
|
fprintf(stderr, _("syntax error in schedule file \"%s\" line %d: %s\n"),
|
||||||
schedule, line_num, scbuf);
|
schedule, line_num, scbuf);
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
num_tests = 0;
|
num_tests = 0;
|
||||||
@ -1536,7 +1525,7 @@ run_schedule(const char *schedule, test_function tfunc)
|
|||||||
/* can't print scbuf here, it's already been trashed */
|
/* can't print scbuf here, it's already been trashed */
|
||||||
fprintf(stderr, _("too many parallel tests in schedule file \"%s\", line %d\n"),
|
fprintf(stderr, _("too many parallel tests in schedule file \"%s\", line %d\n"),
|
||||||
schedule, line_num);
|
schedule, line_num);
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
tests[num_tests] = c;
|
tests[num_tests] = c;
|
||||||
num_tests++;
|
num_tests++;
|
||||||
@ -1548,7 +1537,7 @@ run_schedule(const char *schedule, test_function tfunc)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, _("syntax error in schedule file \"%s\" line %d: %s\n"),
|
fprintf(stderr, _("syntax error in schedule file \"%s\" line %d: %s\n"),
|
||||||
schedule, line_num, scbuf);
|
schedule, line_num, scbuf);
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num_tests == 1)
|
if (num_tests == 1)
|
||||||
@ -1744,7 +1733,7 @@ open_result_files(void)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, _("%s: could not open file \"%s\" for writing: %s\n"),
|
fprintf(stderr, _("%s: could not open file \"%s\" for writing: %s\n"),
|
||||||
progname, logfilename, strerror(errno));
|
progname, logfilename, strerror(errno));
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create the diffs file as empty */
|
/* create the diffs file as empty */
|
||||||
@ -1755,7 +1744,7 @@ open_result_files(void)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, _("%s: could not open file \"%s\" for writing: %s\n"),
|
fprintf(stderr, _("%s: could not open file \"%s\" for writing: %s\n"),
|
||||||
progname, difffilename, strerror(errno));
|
progname, difffilename, strerror(errno));
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
/* we don't keep the diffs file open continuously */
|
/* we don't keep the diffs file open continuously */
|
||||||
fclose(difffile);
|
fclose(difffile);
|
||||||
@ -1853,7 +1842,7 @@ make_absolute_path(const char *in)
|
|||||||
if (!getcwd(cwdbuf, sizeof(cwdbuf)))
|
if (!getcwd(cwdbuf, sizeof(cwdbuf)))
|
||||||
{
|
{
|
||||||
fprintf(stderr, _("could not get current working directory: %s\n"), strerror(errno));
|
fprintf(stderr, _("could not get current working directory: %s\n"), strerror(errno));
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1952,6 +1941,8 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
|
|||||||
progname = get_progname(argv[0]);
|
progname = get_progname(argv[0]);
|
||||||
set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_regress"));
|
set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_regress"));
|
||||||
|
|
||||||
|
atexit(stop_postmaster);
|
||||||
|
|
||||||
#ifndef HAVE_UNIX_SOCKETS
|
#ifndef HAVE_UNIX_SOCKETS
|
||||||
/* no unix domain sockets available, so change default */
|
/* no unix domain sockets available, so change default */
|
||||||
hostname = "localhost";
|
hostname = "localhost";
|
||||||
@ -1969,10 +1960,10 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
|
|||||||
{
|
{
|
||||||
case 'h':
|
case 'h':
|
||||||
help();
|
help();
|
||||||
exit_nicely(0);
|
exit(0);
|
||||||
case 'V':
|
case 'V':
|
||||||
puts("pg_regress (PostgreSQL) " PG_VERSION);
|
puts("pg_regress (PostgreSQL) " PG_VERSION);
|
||||||
exit_nicely(0);
|
exit(0);
|
||||||
case 1:
|
case 1:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2052,7 +2043,7 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
|
|||||||
/* getopt_long already emitted a complaint */
|
/* getopt_long already emitted a complaint */
|
||||||
fprintf(stderr, _("\nTry \"%s -h\" for more information.\n"),
|
fprintf(stderr, _("\nTry \"%s -h\" for more information.\n"),
|
||||||
progname);
|
progname);
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2100,7 +2091,7 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
|
|||||||
if (!top_builddir)
|
if (!top_builddir)
|
||||||
{
|
{
|
||||||
fprintf(stderr, _("--top-builddir must be specified when using --temp-install\n"));
|
fprintf(stderr, _("--top-builddir must be specified when using --temp-install\n"));
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (directory_exists(temp_install))
|
if (directory_exists(temp_install))
|
||||||
@ -2132,7 +2123,7 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
|
|||||||
if (system(buf))
|
if (system(buf))
|
||||||
{
|
{
|
||||||
fprintf(stderr, _("\n%s: installation failed\nExamine %s/log/install.log for the reason.\nCommand was: %s\n"), progname, outputdir, buf);
|
fprintf(stderr, _("\n%s: installation failed\nExamine %s/log/install.log for the reason.\nCommand was: %s\n"), progname, outputdir, buf);
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (sl = extra_install; sl != NULL; sl = sl->next)
|
for (sl = extra_install; sl != NULL; sl = sl->next)
|
||||||
@ -2143,13 +2134,13 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
|
|||||||
makeprog, top_builddir, sl->str, temp_install, outputdir);
|
makeprog, top_builddir, sl->str, temp_install, outputdir);
|
||||||
#else
|
#else
|
||||||
fprintf(stderr, _("\n%s: --extra-install option not supported on this platform\n"), progname);
|
fprintf(stderr, _("\n%s: --extra-install option not supported on this platform\n"), progname);
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (system(buf))
|
if (system(buf))
|
||||||
{
|
{
|
||||||
fprintf(stderr, _("\n%s: installation failed\nExamine %s/log/install.log for the reason.\nCommand was: %s\n"), progname, outputdir, buf);
|
fprintf(stderr, _("\n%s: installation failed\nExamine %s/log/install.log for the reason.\nCommand was: %s\n"), progname, outputdir, buf);
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2164,7 +2155,7 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
|
|||||||
if (system(buf))
|
if (system(buf))
|
||||||
{
|
{
|
||||||
fprintf(stderr, _("\n%s: initdb failed\nExamine %s/log/initdb.log for the reason.\nCommand was: %s\n"), progname, outputdir, buf);
|
fprintf(stderr, _("\n%s: initdb failed\nExamine %s/log/initdb.log for the reason.\nCommand was: %s\n"), progname, outputdir, buf);
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2180,7 +2171,7 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
|
|||||||
if (pg_conf == NULL)
|
if (pg_conf == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, _("\n%s: could not open \"%s\" for adding extra config: %s\n"), progname, buf, strerror(errno));
|
fprintf(stderr, _("\n%s: could not open \"%s\" for adding extra config: %s\n"), progname, buf, strerror(errno));
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
fputs("\n# Configuration added by pg_regress\n\n", pg_conf);
|
fputs("\n# Configuration added by pg_regress\n\n", pg_conf);
|
||||||
fputs("max_prepared_transactions = 2\n", pg_conf);
|
fputs("max_prepared_transactions = 2\n", pg_conf);
|
||||||
@ -2194,7 +2185,7 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
|
|||||||
if (extra_conf == NULL)
|
if (extra_conf == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, _("\n%s: could not open \"%s\" to read extra config: %s\n"), progname, temp_config, strerror(errno));
|
fprintf(stderr, _("\n%s: could not open \"%s\" to read extra config: %s\n"), progname, temp_config, strerror(errno));
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
while (fgets(line_buf, sizeof(line_buf), extra_conf) != NULL)
|
while (fgets(line_buf, sizeof(line_buf), extra_conf) != NULL)
|
||||||
fputs(line_buf, pg_conf);
|
fputs(line_buf, pg_conf);
|
||||||
@ -2222,7 +2213,7 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
|
|||||||
if (!port_specified_by_user)
|
if (!port_specified_by_user)
|
||||||
fprintf(stderr, _("%s: could not determine an available port\n"), progname);
|
fprintf(stderr, _("%s: could not determine an available port\n"), progname);
|
||||||
fprintf(stderr, _("Specify an unused port using the --port option or shut down any conflicting PostgreSQL servers.\n"));
|
fprintf(stderr, _("Specify an unused port using the --port option or shut down any conflicting PostgreSQL servers.\n"));
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, _("port %d apparently in use, trying %d\n"), port, port + 1);
|
fprintf(stderr, _("port %d apparently in use, trying %d\n"), port, port + 1);
|
||||||
@ -2249,7 +2240,7 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
|
|||||||
{
|
{
|
||||||
fprintf(stderr, _("\n%s: could not spawn postmaster: %s\n"),
|
fprintf(stderr, _("\n%s: could not spawn postmaster: %s\n"),
|
||||||
progname, strerror(errno));
|
progname, strerror(errno));
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2273,7 +2264,7 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
fprintf(stderr, _("\n%s: postmaster failed\nExamine %s/log/postmaster.log for the reason\n"), progname, outputdir);
|
fprintf(stderr, _("\n%s: postmaster failed\nExamine %s/log/postmaster.log for the reason\n"), progname, outputdir);
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
pg_usleep(1000000L);
|
pg_usleep(1000000L);
|
||||||
@ -2299,7 +2290,7 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
|
|||||||
progname, GetLastError());
|
progname, GetLastError());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
postmaster_running = true;
|
postmaster_running = true;
|
||||||
@ -2414,7 +2405,7 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fail_count != 0)
|
if (fail_count != 0)
|
||||||
exit_nicely(1);
|
exit(1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,5 @@ int regression_main(int argc, char *argv[],
|
|||||||
init_function ifunc, test_function tfunc);
|
init_function ifunc, test_function tfunc);
|
||||||
void add_stringlist_item(_stringlist ** listhead, const char *str);
|
void add_stringlist_item(_stringlist ** listhead, const char *str);
|
||||||
PID_TYPE spawn_process(const char *cmdline);
|
PID_TYPE spawn_process(const char *cmdline);
|
||||||
void exit_nicely(int code);
|
|
||||||
void replace_string(char *string, char *replace, char *replacement);
|
void replace_string(char *string, char *replace, char *replacement);
|
||||||
bool file_exists(const char *file);
|
bool file_exists(const char *file);
|
||||||
|
@ -77,7 +77,7 @@ psql_start_test(const char *testname,
|
|||||||
{
|
{
|
||||||
fprintf(stderr, _("could not start process for test %s\n"),
|
fprintf(stderr, _("could not start process for test %s\n"),
|
||||||
testname);
|
testname);
|
||||||
exit_nicely(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return pid;
|
return pid;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user