27 #ifdef HAVE_SYS_RESOURCE_H
29 #include <sys/resource.h>
39 #include "pg_config_paths.h"
105 #ifdef HAVE_UNIX_SOCKETS
106 static const char *temp_sockdir;
132 #if defined(HAVE_GETRLIMIT) && defined(RLIMIT_CORE)
134 unlimit_core_size(
void)
138 getrlimit(RLIMIT_CORE, &lim);
139 if (lim.rlim_max == 0)
142 _(
"%s: could not set core size: disallowed by hard limit\n"),
146 else if (lim.rlim_max == RLIM_INFINITY || lim.rlim_cur < lim.rlim_max)
148 lim.rlim_cur = lim.rlim_max;
149 setrlimit(RLIMIT_CORE, &lim);
165 newentry->
next = NULL;
166 if (*listhead == NULL)
167 *listhead = newentry;
170 for (oldentry = *listhead; oldentry->
next; oldentry = oldentry->
next)
172 oldentry->
next = newentry;
182 if (listhead == NULL || *listhead == NULL)
184 if ((*listhead)->next != NULL)
186 free((*listhead)->str);
198 char *token = strtok(sc, delim);
203 token = strtok(NULL, delim);
221 fprintf(
stdout,
"============== %-38s ==============\n", tmp);
275 "\"%s%spg_ctl\" stop -D \"%s/data\" -s",
282 fprintf(stderr,
_(
"\n%s: could not stop postmaster: exit code was %d\n"),
291 #ifdef HAVE_UNIX_SOCKETS
314 signal_remove_temp(
int signum)
335 make_temp_sockdir(
void)
337 char *
template =
psprintf(
"%s/pg_regress-XXXXXX",
338 getenv(
"TMPDIR") ? getenv(
"TMPDIR") :
"/tmp");
340 temp_sockdir =
mkdtemp(
template);
341 if (temp_sockdir == NULL)
343 fprintf(stderr,
_(
"%s: could not create directory \"%s\": %s\n"),
350 snprintf(socklock,
sizeof(socklock),
"%s.lock", sockself);
360 pqsignal(SIGINT, signal_remove_temp);
362 pqsignal(SIGTERM, signal_remove_temp);
383 while (*
str && *pattern)
385 if (*pattern ==
'.' && pattern[1] ==
'*')
389 if (*pattern ==
'\0')
402 if (*
str == *pattern || *pattern ==
'.')
416 else if (*pattern !=
'.' && *
str != *pattern)
429 if (*pattern ==
'\0')
433 while (*pattern ==
'.' && pattern[1] ==
'*')
435 if (*pattern ==
'\0')
468 fprintf(stderr,
_(
"%s: could not open file \"%s\" for reading: %s\n"),
473 while (fgets(
buf,
sizeof(
buf), f))
482 while (
i > 0 && isspace((
unsigned char)
buf[
i - 1]))
486 file_type = strchr(
buf,
':');
489 fprintf(stderr,
_(
"incorrectly formatted resultmap entry: %s\n"),
495 platform = strchr(file_type,
':');
498 fprintf(stderr,
_(
"incorrectly formatted resultmap entry: %s\n"),
503 expected = strchr(platform,
'=');
506 fprintf(stderr,
_(
"incorrectly formatted resultmap entry: %s\n"),
546 if (!file || !(file_type = strrchr(file,
'.')))
553 if (strcmp(testname, rm->
test) == 0 && strcmp(file_type, rm->
type) == 0)
572 setenv(
"PGAPPNAME",
"pg_regress", 1);
580 setenv(
"PG_DLSUFFIX", DLSUFFIX, 1);
602 #if defined(WIN32) || defined(__CYGWIN__) || defined(__darwin__)
615 setenv(
"LC_MESSAGES",
"C", 1);
628 setenv(
"PGTZ",
"PST8PDT", 1);
629 setenv(
"PGDATESTYLE",
"Postgres, MDY", 1);
637 const char *my_pgoptions =
"-c intervalstyle=postgres_verbose";
638 const char *old_pgoptions = getenv(
"PGOPTIONS");
644 old_pgoptions, my_pgoptions);
645 setenv(
"PGOPTIONS", new_pgoptions, 1);
679 unsetenv(
"PGSSLMAXPROTOCOLVERSION");
680 unsetenv(
"PGSSLMINPROTOCOLVERSION");
689 #ifdef HAVE_UNIX_SOCKETS
694 sockdir = getenv(
"PG_REGRESS_SOCK_DIR");
747 pghost = getenv(
"PGHOST");
748 pgport = getenv(
"PGPORT");
752 #ifdef HAVE_UNIX_SOCKETS
763 printf(
_(
"(using postmaster on %s, default port)\n"),
pghost);
765 printf(
_(
"(using postmaster on Unix socket, port %s)\n"),
pgport);
767 printf(
_(
"(using postmaster on Unix socket, default port)\n"));
777 fmtHba(
const char *raw)
783 wp = ret =
pg_realloc(ret, 3 + strlen(raw) * 2);
786 for (rp = raw; *rp; rp++)
803 current_windows_user(
const char **acct,
const char **dom)
808 TOKEN_USER *tokenuser;
810 DWORD accountnamesize =
sizeof(accountname);
811 DWORD domainnamesize =
sizeof(domainname);
812 SID_NAME_USE accountnameuse;
814 if (!OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &token))
817 _(
"%s: could not open process token: error code %lu\n"),
822 if (!GetTokenInformation(token, TokenUser, NULL, 0, &retlen) && GetLastError() != 122)
825 _(
"%s: could not get token information buffer size: error code %lu\n"),
830 if (!GetTokenInformation(token, TokenUser, tokenuser, retlen, &retlen))
833 _(
"%s: could not get token information: error code %lu\n"),
838 if (!LookupAccountSid(NULL, tokenuser->User.Sid, accountname, &accountnamesize,
839 domainname, &domainnamesize, &accountnameuse))
842 _(
"%s: could not look up account SID: error code %lu\n"),
862 config_sspi_auth(
const char *pgdata,
const char *superuser_name)
864 const char *accountname,
875 current_windows_user(&accountname, &domainname);
878 if (superuser_name == NULL)
888 if (superuser_name == NULL)
913 have_ipv6 = (WSAStartup(MAKEWORD(2, 2), &wsaData) == 0 &&
914 getaddrinfo(
"::1", NULL, &hints, &gai_result) == 0);
922 fprintf(stderr, _("%s: could not write to file \"%s\": %s\n"), \
923 progname, fname, strerror(errno)); \
928 res =
snprintf(fname,
sizeof(fname),
"%s/pg_hba.conf", pgdata);
929 if (res < 0 || res >=
sizeof(fname))
938 hba = fopen(fname,
"w");
941 fprintf(stderr,
_(
"%s: could not open file \"%s\" for writing: %s\n"),
945 CW(fputs(
"# Configuration written by config_sspi_auth()\n", hba) >= 0);
946 CW(fputs(
"host all all 127.0.0.1/32 sspi include_realm=1 map=regress\n",
949 CW(fputs(
"host all all ::1/128 sspi include_realm=1 map=regress\n",
951 CW(fclose(hba) == 0);
953 snprintf(fname,
sizeof(fname),
"%s/pg_ident.conf", pgdata);
954 ident = fopen(fname,
"w");
957 fprintf(stderr,
_(
"%s: could not open file \"%s\" for writing: %s\n"),
961 CW(fputs(
"# Configuration written by config_sspi_auth()\n", ident) >= 0);
968 CW(
fprintf(ident,
"regress \"%s@%s\" %s\n",
969 accountname, domainname, fmtHba(superuser_name)) >= 0);
971 CW(
fprintf(ident,
"regress \"%s@%s\" %s\n",
972 accountname, domainname, fmtHba(sl->
str)) >= 0);
973 CW(fclose(ident) == 0);
1024 for (cmdptr = cmdbuf.
data; *cmdptr; cmdptr++)
1026 if (strchr(
"\\\"$`", *cmdptr))
1045 if (system(
buf->data) != 0)
1048 fprintf(stderr,
_(
"command failed: %s\n"),
buf->data);
1060 #define psql_command(database, ...) \
1062 StringInfo cmdbuf = psql_start_command(); \
1063 psql_add_command(cmdbuf, __VA_ARGS__); \
1064 psql_end_command(cmdbuf, database); \
1094 fprintf(stderr,
_(
"%s: could not fork: %s\n"),
1109 cmdline2 =
psprintf(
"exec %s", cmdline);
1111 fprintf(stderr,
_(
"%s: could not exec \"%s\": %s\n"),
1118 PROCESS_INFORMATION pi;
1120 HANDLE restrictedToken;
1121 const char *comspec;
1124 comspec = getenv(
"COMSPEC");
1125 if (comspec == NULL)
1128 memset(&pi, 0,
sizeof(pi));
1129 cmdline2 =
psprintf(
"\"%s\" /c \"%s\"", comspec, cmdline);
1131 if ((restrictedToken =
1132 CreateRestrictedProcess(cmdline2, &pi)) == 0)
1135 CloseHandle(pi.hThread);
1147 FILE *f = fopen(file,
"r");
1151 fprintf(stderr,
_(
"%s: could not open file \"%s\" for reading: %s\n"),
1155 fseek(f, 0, SEEK_END);
1169 FILE *f = fopen(file,
"r");
1173 fprintf(stderr,
_(
"%s: could not open file \"%s\" for reading: %s\n"),
1177 while ((
c = fgetc(f)) != EOF)
1189 FILE *f = fopen(file,
"r");
1202 if (
stat(dir, &st) != 0)
1215 fprintf(stderr,
_(
"%s: could not create directory \"%s\": %s\n"),
1228 int ssize = strlen(expectfile) + 2 + 1;
1232 if (!(tmp = (
char *)
malloc(ssize)))
1235 if (!(s = (
char *)
malloc(ssize)))
1241 strcpy(tmp, expectfile);
1242 last_dot = strrchr(tmp,
'.');
1250 snprintf(s, ssize,
"%s_%d.%s", tmp,
i, last_dot + 1);
1266 fprintf(stderr,
_(
"diff command failed with status %d: %s\n"), r, cmd);
1277 fprintf(stderr,
_(
"diff command not found: %s\n"), cmd);
1292 results_differ(
const char *testname,
const char *resultsfile,
const char *default_expectfile)
1299 int best_line_count;
1302 const char *platform_expectfile;
1310 strlcpy(expectfile, default_expectfile,
sizeof(expectfile));
1311 if (platform_expectfile)
1317 char *p = strrchr(expectfile,
'/');
1320 strcpy(++p, platform_expectfile);
1324 snprintf(diff,
sizeof(diff),
"%s.diff", resultsfile);
1328 "diff %s \"%s\" \"%s\" > \"%s\"",
1340 strcpy(best_expect_file, expectfile);
1342 for (
i = 0;
i <= 9;
i++)
1344 char *alt_expectfile;
1347 if (!alt_expectfile)
1349 fprintf(stderr,
_(
"Unable to check secondary comparison files: %s\n"),
1356 free(alt_expectfile);
1361 "diff %s \"%s\" \"%s\" > \"%s\"",
1367 free(alt_expectfile);
1372 if (l < best_line_count)
1375 best_line_count = l;
1376 strlcpy(best_expect_file, alt_expectfile,
sizeof(best_expect_file));
1378 free(alt_expectfile);
1386 if (platform_expectfile)
1389 "diff %s \"%s\" \"%s\" > \"%s\"",
1400 if (l < best_line_count)
1403 best_line_count = l;
1404 strlcpy(best_expect_file, default_expectfile,
sizeof(best_expect_file));
1425 "diff %s \"%s\" \"%s\" >> \"%s\"",
1443 char **names,
int num_tests)
1451 memcpy(active_pids, pids, num_tests *
sizeof(
PID_TYPE));
1454 tests_left = num_tests;
1455 while (tests_left > 0)
1462 p = wait(&exit_status);
1466 fprintf(stderr,
_(
"failed to wait for subprocesses: %s\n"),
1474 r = WaitForMultipleObjects(tests_left, active_pids, FALSE, INFINITE);
1475 if (r < WAIT_OBJECT_0 || r >= WAIT_OBJECT_0 + tests_left)
1477 fprintf(stderr,
_(
"failed to wait for subprocesses: error code %lu\n"),
1481 p = active_pids[r - WAIT_OBJECT_0];
1483 active_pids[r - WAIT_OBJECT_0] = active_pids[tests_left - 1];
1486 for (
i = 0;
i < num_tests;
i++)
1491 GetExitCodeProcess(pids[
i], &exit_status);
1492 CloseHandle(pids[
i]);
1495 statuses[
i] = (int) exit_status;
1517 status(
_(
" (test process exited with exit code %d)"),
1522 status(
_(
" (test process was terminated by exception 0x%X)"),
1525 status(
_(
" (test process was terminated by signal %d: %s)"),
1530 status(
_(
" (test process exited with unrecognized status %d)"),
1541 #define MAX_PARALLEL_TESTS 100
1555 memset(tests, 0,
sizeof(tests));
1556 memset(resultfiles, 0,
sizeof(resultfiles));
1557 memset(expectfiles, 0,
sizeof(expectfiles));
1558 memset(tags, 0,
sizeof(tags));
1560 scf = fopen(schedule,
"r");
1563 fprintf(stderr,
_(
"%s: could not open file \"%s\" for reading: %s\n"),
1568 while (fgets(scbuf,
sizeof(scbuf), scf))
1580 while (
i > 0 && isspace((
unsigned char) scbuf[
i - 1]))
1583 if (scbuf[0] ==
'\0' || scbuf[0] ==
'#')
1585 if (strncmp(scbuf,
"test: ", 6) == 0)
1587 else if (strncmp(scbuf,
"ignore: ", 8) == 0)
1590 while (*
c && isspace((
unsigned char) *
c))
1603 fprintf(stderr,
_(
"syntax error in schedule file \"%s\" line %d: %s\n"),
1604 schedule, line_num, scbuf);
1612 if (*
c ==
'\0' || isspace((
unsigned char) *
c))
1621 fprintf(stderr,
_(
"too many parallel tests (more than %d) in schedule file \"%s\" line %d: %s\n"),
1645 fprintf(stderr,
_(
"syntax error in schedule file \"%s\" line %d: %s\n"),
1646 schedule, line_num, scbuf);
1652 status(
_(
"test %-28s ... "), tests[0]);
1653 pids[0] = (startfunc) (tests[0], &resultfiles[0], &expectfiles[0], &tags[0]);
1660 fprintf(stderr,
_(
"too many parallel tests (more than %d) in schedule file \"%s\" line %d: %s\n"),
1668 status(
_(
"parallel group (%d tests, in groups of %d): "),
1670 for (
i = 0;
i < num_tests;
i++)
1676 tests + oldest,
i - oldest);
1679 pids[
i] = (startfunc) (tests[
i], &resultfiles[
i], &expectfiles[
i], &tags[
i]);
1684 tests + oldest,
i - oldest);
1689 status(
_(
"parallel group (%d tests): "), num_tests);
1690 for (
i = 0;
i < num_tests;
i++)
1692 pids[
i] = (startfunc) (tests[
i], &resultfiles[
i], &expectfiles[
i], &tags[
i]);
1700 for (
i = 0;
i < num_tests;
i++)
1705 bool differ =
false;
1708 status(
_(
" %-28s ... "), tests[
i]);
1717 for (rl = resultfiles[
i], el = expectfiles[
i], tl = tags[
i];
1720 tl = tl ? tl->
next : NULL)
1725 (*postfunc) (rl->
str);
1736 bool ignore =
false;
1739 for (sl = ignorelist; sl != NULL; sl = sl->
next)
1741 if (strcmp(tests[
i], sl->
str) == 0)
1749 status(
_(
"failed (ignored)"));
1764 if (statuses[
i] != 0)
1773 for (
i = 0;
i < num_tests;
i++)
1805 bool differ =
false;
1808 pid = (startfunc) (
test, &resultfiles, &expectfiles, &tags);
1819 for (rl = resultfiles, el = expectfiles, tl = tags;
1822 tl = tl ? tl->
next : NULL)
1827 (*postfunc) (rl->
str);
1847 if (exit_status != 0)
1875 fprintf(stderr,
_(
"%s: could not open file \"%s\" for writing: %s\n"),
1886 fprintf(stderr,
_(
"%s: could not open file \"%s\" for writing: %s\n"),
1924 (
nolocale) ?
" LC_COLLATE='C' LC_CTYPE='C'" :
"");
1927 (
nolocale) ?
" LC_COLLATE='C' LC_CTYPE='C'" :
"");
1929 "ALTER DATABASE \"%s\" SET lc_messages TO 'C';"
1930 "ALTER DATABASE \"%s\" SET lc_monetary TO 'C';"
1931 "ALTER DATABASE \"%s\" SET lc_numeric TO 'C';"
1932 "ALTER DATABASE \"%s\" SET lc_time TO 'C';"
1933 "ALTER DATABASE \"%s\" SET bytea_output TO 'hex';"
1934 "ALTER DATABASE \"%s\" SET timezone_abbreviations TO 'Default';",
1954 header(
_(
"dropping role \"%s\""), rolename);
1966 header(
_(
"creating role \"%s\""), rolename);
1968 for (; granted_dbs != NULL; granted_dbs = granted_dbs->
next)
1971 granted_dbs->
str, rolename);
1979 printf(
_(
"PostgreSQL regression test driver\n"));
1984 printf(
_(
" --bindir=BINPATH use BINPATH for programs that are run;\n"));
1985 printf(
_(
" if empty, use PATH from the environment\n"));
1986 printf(
_(
" --config-auth=DATADIR update authentication settings for DATADIR\n"));
1987 printf(
_(
" --create-role=ROLE create the specified role before testing\n"));
1988 printf(
_(
" --dbname=DB use database DB (default \"regression\")\n"));
1989 printf(
_(
" --debug turn on debug mode in programs that are run\n"));
1990 printf(
_(
" --dlpath=DIR look for dynamic libraries in DIR\n"));
1991 printf(
_(
" --encoding=ENCODING use ENCODING as the encoding\n"));
1992 printf(
_(
" -h, --help show this help, then exit\n"));
1993 printf(
_(
" --inputdir=DIR take input files from DIR (default \".\")\n"));
1994 printf(
_(
" --launcher=CMD use CMD as launcher of psql\n"));
1995 printf(
_(
" --load-extension=EXT load the named extension before running the\n"));
1996 printf(
_(
" tests; can appear multiple times\n"));
1997 printf(
_(
" --max-connections=N maximum number of concurrent connections\n"));
1998 printf(
_(
" (default is 0, meaning unlimited)\n"));
1999 printf(
_(
" --max-concurrent-tests=N maximum number of concurrent tests in schedule\n"));
2000 printf(
_(
" (default is 0, meaning unlimited)\n"));
2001 printf(
_(
" --outputdir=DIR place output files in DIR (default \".\")\n"));
2002 printf(
_(
" --schedule=FILE use test ordering schedule from FILE\n"));
2003 printf(
_(
" (can be used multiple times to concatenate)\n"));
2004 printf(
_(
" --temp-instance=DIR create a temporary instance in DIR\n"));
2005 printf(
_(
" --use-existing use an existing installation\n"));
2006 printf(
_(
" -V, --version output version information, then exit\n"));
2008 printf(
_(
"Options for \"temp-instance\" mode:\n"));
2009 printf(
_(
" --no-locale use C locale\n"));
2010 printf(
_(
" --port=PORT start postmaster on PORT\n"));
2011 printf(
_(
" --temp-config=FILE append contents of FILE to temporary config\n"));
2013 printf(
_(
"Options for using an existing installation:\n"));
2014 printf(
_(
" --host=HOST use postmaster running on HOST\n"));
2015 printf(
_(
" --port=PORT use postmaster running at PORT\n"));
2016 printf(
_(
" --user=USER connect as USER\n"));
2018 printf(
_(
"The exit status is 0 if all tests passed, 1 if some tests failed, and 2\n"));
2019 printf(
_(
"if the tests could not be run for some reason.\n"));
2021 printf(
_(
"Report bugs to <%s>.\n"), PACKAGE_BUGREPORT);
2022 printf(
_(
"%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
2031 static struct option long_options[] = {
2058 bool use_unix_sockets;
2074 #if !defined(HAVE_UNIX_SOCKETS)
2075 use_unix_sockets =
false;
2076 #elif defined(WIN32)
2083 use_unix_sockets = getenv(
"PG_TEST_USE_UNIX_SOCKETS") ?
true :
false;
2085 use_unix_sockets =
true;
2088 if (!use_unix_sockets)
2097 if (getenv(
"PG_REGRESS_DIFF_OPTS"))
2100 while ((
c =
getopt_long(argc, argv,
"hV", long_options, &option_index)) != -1)
2108 puts(
"pg_regress (PostgreSQL) " PG_VERSION);
2186 fprintf(stderr,
_(
"\nTry \"%s -h\" for more information.\n"),
2195 while (argc -
optind >= 1)
2204 if (!use_unix_sockets)
2219 port = 0xC000 | (PG_VERSION_NUM & 0x3FFF);
2232 #if defined(HAVE_GETRLIMIT) && defined(RLIMIT_CORE)
2233 unlimit_core_size();
2239 const char *env_wait;
2248 header(
_(
"removing existing temp instance"));
2251 fprintf(stderr,
_(
"\n%s: could not remove temp instance \"%s\"\n"),
2257 header(
_(
"creating temporary instance"));
2268 header(
_(
"initializing database system"));
2270 "\"%s%sinitdb\" -D \"%s/data\" --no-clean --no-sync%s%s > \"%s/log/initdb.log\" 2>&1",
2274 debug ?
" --debug" :
"",
2292 pg_conf = fopen(
buf,
"a");
2293 if (pg_conf == NULL)
2298 fputs(
"\n# Configuration added by pg_regress\n\n", pg_conf);
2299 fputs(
"log_autovacuum_min_duration = 0\n", pg_conf);
2300 fputs(
"log_checkpoints = on\n", pg_conf);
2301 fputs(
"log_line_prefix = '%m %b[%p] %q%a '\n", pg_conf);
2302 fputs(
"log_lock_waits = on\n", pg_conf);
2303 fputs(
"log_temp_files = 128kB\n", pg_conf);
2304 fputs(
"max_prepared_transactions = 2\n", pg_conf);
2308 char *temp_config = sl->
str;
2310 char line_buf[1024];
2312 extra_conf = fopen(temp_config,
"r");
2313 if (extra_conf == NULL)
2315 fprintf(stderr,
_(
"\n%s: could not open \"%s\" to read extra config: %s\n"),
progname, temp_config,
strerror(errno));
2318 while (fgets(line_buf,
sizeof(line_buf), extra_conf) != NULL)
2319 fputs(line_buf, pg_conf);
2326 if (!use_unix_sockets)
2333 config_sspi_auth(
buf, NULL);
2335 #elif !defined(HAVE_UNIX_SOCKETS)
2336 #error Platform has no means to secure the test installation.
2343 "\"%s%spsql\" -X postgres <%s 2>%s",
2348 for (
i = 0;
i < 16;
i++)
2350 if (system(buf2) == 0)
2356 fprintf(stderr,
_(
"port %d apparently in use\n"),
port);
2358 fprintf(stderr,
_(
"%s: could not determine an available port\n"),
progname);
2359 fprintf(stderr,
_(
"Specify an unused port using the --port option or shut down any conflicting PostgreSQL servers.\n"));
2363 fprintf(stderr,
_(
"port %d apparently in use, trying %d\n"),
port,
port + 1);
2375 header(
_(
"starting postmaster"));
2377 "\"%s%spostgres\" -D \"%s/data\" -F%s "
2378 "-c \"listen_addresses=%s\" -k \"%s\" "
2379 "> \"%s/log/postmaster.log\" 2>&1",
2388 fprintf(stderr,
_(
"\n%s: could not spawn postmaster: %s\n"),
2400 env_wait = getenv(
"PGCTLTIMEOUT");
2401 if (env_wait != NULL)
2413 if (system(buf2) == 0)
2433 fprintf(stderr,
_(
"\n%s: postmaster did not respond within %d seconds\nExamine %s/log/postmaster.log for the reason\n"),
2445 fprintf(stderr,
_(
"\n%s: could not kill failed postmaster: %s\n"),
2449 fprintf(stderr,
_(
"\n%s: could not kill failed postmaster: error code %lu\n"),
2460 #define ULONGPID(x) (unsigned long) (unsigned long long) (x)
2462 #define ULONGPID(x) (unsigned long) (x)
2464 printf(
_(
"running on port %d with PID %lu\n"),
2496 header(
_(
"running regression test queries"));
2513 header(
_(
"shutting down postmaster"));
2524 header(
_(
"removing temporary instance"));
2526 fprintf(stderr,
_(
"\n%s: could not remove temp instance \"%s\"\n"),
2537 _(
" All %d tests passed. "),
2541 _(
" %d of %d tests passed, %d failed test(s) ignored. "),
2547 _(
" %d of %d tests failed. "),
2553 _(
" %d of %d tests failed, %d of these failures ignored. "),
2559 for (
i = strlen(
buf);
i > 0;
i--)
2562 for (
i = strlen(
buf);
i > 0;
i--)
2569 printf(
_(
"The differences that caused some tests to fail can be viewed in the\n"
2570 "file \"%s\". A copy of the test summary that you see\n"
2571 "above is saved in the file \"%s\".\n\n"),
#define PG_TEXTDOMAIN(domain)
#define pg_attribute_printf(f, a)
void set_pglocale_pgservice(const char *argv0, const char *app)
static void PGresult * res
void * pg_realloc(void *ptr, size_t size)
char * pg_strdup(const char *in)
void * pg_malloc(size_t size)
int getopt_long(int argc, char *const argv[], const char *optstring, const struct option *longopts, int *longindex)
#define required_argument
#define INSTR_TIME_SET_CURRENT(t)
#define INSTR_TIME_SUBTRACT(x, y)
struct timeval instr_time
#define INSTR_TIME_GET_MILLISEC(t)
static void const char fflush(stdout)
vfprintf(stderr, fmt, args)
Assert(fmt[strlen(fmt) - 1] !='\n')
static void const char * fmt
void pg_logging_init(const char *argv0)
void pfree(void *pointer)
#define DEFAULT_PGSOCKET_DIR
PGDLLIMPORT char * optarg
static void open_result_files(void)
static int max_connections
static void status_end(void)
static bool port_specified_by_user
static int file_line_count(const char *file)
static void load_resultmap(void)
static void psql_add_command(StringInfo buf, const char *query,...) pg_attribute_printf(2
static void static void static StringInfo psql_start_command(void)
bool file_exists(const char *file)
static void stop_postmaster(void)
static int max_concurrent_tests
static void create_database(const char *dbname)
static void free_stringlist(_stringlist **listhead)
static void drop_role_if_exists(const char *rolename)
#define MAX_PARALLEL_TESTS
static void static void psql_end_command(StringInfo buf, const char *database)
static bool directory_exists(const char *dir)
static _stringlist * schedulelist
static _stringlist * loadextension
static char * logfilename
static _stringlist * temp_configs
static _stringlist * extra_tests
static void make_directory(const char *dir)
static void split_to_stringlist(const char *s, const char *delim, _stringlist **listhead)
static int run_diff(const char *cmd, const char *filename)
static void run_single_test(const char *test, test_start_function startfunc, postprocess_result_function postfunc)
const char * pretty_diff_opts
static void log_child_failure(int exitstatus)
int regression_main(int argc, char *argv[], init_function ifunc, test_start_function startfunc, postprocess_result_function postfunc)
static char * difffilename
static const char * get_expectfile(const char *testname, const char *file)
static _resultmap * resultmap
struct _resultmap _resultmap
static void header(const char *fmt,...) pg_attribute_printf(1
static char * config_auth_datadir
static void drop_database_if_exists(const char *dbname)
const char * basic_diff_opts
static void initialize_environment(void)
static char * temp_instance
static int fail_ignore_count
static void wait_for_tests(PID_TYPE *pids, int *statuses, instr_time *stoptimes, char **names, int num_tests)
static const char * sockdir
static long file_size(const char *file)
static void static void status(const char *fmt,...) pg_attribute_printf(1
static bool postmaster_running
static const char * progname
static _stringlist * extraroles
static bool results_differ(const char *testname, const char *resultsfile, const char *default_expectfile)
PID_TYPE spawn_process(const char *cmdline)
static void create_role(const char *rolename, const _stringlist *granted_dbs)
static void run_schedule(const char *schedule, test_start_function startfunc, postprocess_result_function postfunc)
void add_stringlist_item(_stringlist **listhead, const char *str)
static bool string_matches_pattern(const char *str, const char *pattern)
static char * get_alternative_expectfile(const char *expectfile, int i)
#define psql_command(database,...)
static PID_TYPE postmaster_pid
void(* init_function)(int argc, char **argv)
PID_TYPE(* test_start_function)(const char *testname, _stringlist **resultfiles, _stringlist **expectfiles, _stringlist **tags)
void(* postprocess_result_function)(const char *filename)
char * make_absolute_path(const char *path)
const char * get_progname(const char *argv0)
const char * pg_strsignal(int signum)
size_t strlcpy(char *dst, const char *src, size_t siz)
char * mkdtemp(char *path)
#define UNIXSOCK_PATH(path, port, sockdir)
char * psprintf(const char *fmt,...)
void get_restricted_token(void)
bool rmtree(const char *path, bool rmtopdir)
void pg_usleep(long microsec)
pqsigfunc pqsignal(int signum, pqsigfunc handler)
int appendStringInfoVA(StringInfo str, const char *fmt, va_list args)
StringInfo makeStringInfo(void)
void appendStringInfo(StringInfo str, const char *fmt,...)
void enlargeStringInfo(StringInfo str, int needed)
void appendStringInfoString(StringInfo str, const char *s)
void appendStringInfoChar(StringInfo str, char ch)
void initStringInfo(StringInfo str)
struct _stringlist * next
struct sockaddr * ai_addr
struct addrinfo * ai_next
const char * get_user_name(char **errstr)