36#include "pg_config_paths.h"
76#define TESTNAME_WIDTH 36
82#define WAIT_TICKS_PER_SECOND 20
146static void test_status_print(
bool ok,
const char *testname,
double runtime,
bool parallel);
147static void test_status_ok(
const char *testname,
double runtime,
bool parallel);
161#define plan(x) emit_tap_output(PLAN, "1..%i", (x))
162#define note(...) emit_tap_output(NOTE, __VA_ARGS__)
163#define note_detail(...) emit_tap_output(NOTE_DETAIL, __VA_ARGS__)
164#define diag(...) emit_tap_output(DIAG, __VA_ARGS__)
165#define note_end() emit_tap_output(NOTE_END, "\n");
166#define bail_noatexit(...) bail_out(true, __VA_ARGS__)
167#define bail(...) bail_out(false, __VA_ARGS__)
172#if defined(HAVE_GETRLIMIT)
178 getrlimit(RLIMIT_CORE, &lim);
179 if (lim.rlim_max == 0)
181 diag(
"could not set core size: disallowed by hard limit");
184 else if (lim.rlim_max == RLIM_INFINITY || lim.rlim_cur < lim.rlim_max)
186 lim.rlim_cur = lim.rlim_max;
187 setrlimit(RLIMIT_CORE, &lim);
203 newentry->
next = NULL;
204 if (*listhead == NULL)
205 *listhead = newentry;
208 for (oldentry = *listhead; oldentry->
next; oldentry = oldentry->
next)
210 oldentry->
next = newentry;
220 if (listhead == NULL || *listhead == NULL)
222 if ((*listhead)->next != NULL)
224 free((*listhead)->str);
294 (ok ? (
int) strlen(
"not ") : 0),
"",
296 (parallel ?
'+' :
'-'),
343 va_list argp_logfile;
378 va_copy(argp_logfile, argp);
442 "\"%s%spg_ctl\" stop -D \"%s/data\" -s",
451 bail_noatexit(
_(
"could not stop postmaster: exit code was %d"), r);
485 raise(postgres_signal_arg);
503 char *
template =
psprintf(
"%s/pg_regress-XXXXXX",
504 getenv(
"TMPDIR") ? getenv(
"TMPDIR") :
"/tmp");
508 bail(
"could not create directory \"%s\": %m",
template);
544 while (*
str && *pattern)
546 if (*pattern ==
'.' && pattern[1] ==
'*')
550 if (*pattern ==
'\0')
563 if (*
str == *pattern || *pattern ==
'.')
577 else if (*pattern !=
'.' && *
str != *pattern)
590 if (*pattern ==
'\0')
594 while (*pattern ==
'.' && pattern[1] ==
'*')
596 if (*pattern ==
'\0')
629 bail(
"could not open file \"%s\" for reading: %m",
buf);
632 while (fgets(
buf,
sizeof(
buf), f))
641 while (
i > 0 && isspace((
unsigned char)
buf[
i - 1]))
645 file_type = strchr(
buf,
':');
648 bail(
"incorrectly formatted resultmap entry: %s",
buf);
652 platform = strchr(file_type,
':');
655 bail(
"incorrectly formatted resultmap entry: %s",
buf);
658 expected = strchr(platform,
'=');
661 bail(
"incorrectly formatted resultmap entry: %s",
buf);
699 if (!file || !(file_type = strrchr(file,
'.')))
706 if (strcmp(testname, rm->
test) == 0 && strcmp(file_type, rm->
type) == 0)
725 setenv(
"PGAPPNAME",
"pg_regress", 1);
733 setenv(
"PG_DLSUFFIX", DLSUFFIX, 1);
755#if defined(WIN32) || defined(__CYGWIN__) || defined(__darwin__)
768 setenv(
"LC_MESSAGES",
"C", 1);
781 setenv(
"PGTZ",
"America/Los_Angeles", 1);
782 setenv(
"PGDATESTYLE",
"Postgres, MDY", 1);
790 const char *my_pgoptions =
"-c intervalstyle=postgres_verbose";
791 const char *old_pgoptions = getenv(
"PGOPTIONS");
797 old_pgoptions, my_pgoptions);
798 setenv(
"PGOPTIONS", new_pgoptions, 1);
833 unsetenv(
"PGSSLMAXPROTOCOLVERSION");
834 unsetenv(
"PGSSLMINPROTOCOLVERSION");
847 sockdir = getenv(
"PG_REGRESS_SOCK_DIR");
896 pghost = getenv(
"PGHOST");
897 pgport = getenv(
"PGPORT");
910 note(
"using postmaster on %s, default port",
pghost);
912 note(
"using postmaster on Unix socket, port %s",
pgport);
914 note(
"using postmaster on Unix socket, default port");
924fmtHba(
const char *raw)
930 wp = ret =
pg_realloc(ret, 3 + strlen(raw) * 2);
933 for (rp = raw; *rp; rp++)
950current_windows_user(
const char **acct,
const char **dom)
955 TOKEN_USER *tokenuser;
957 DWORD accountnamesize =
sizeof(accountname);
958 DWORD domainnamesize =
sizeof(domainname);
959 SID_NAME_USE accountnameuse;
961 if (!OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &
token))
963 bail(
"could not open process token: error code %lu", GetLastError());
966 if (!GetTokenInformation(
token, TokenUser, NULL, 0, &retlen) && GetLastError() != 122)
968 bail(
"could not get token information buffer size: error code %lu",
972 if (!GetTokenInformation(
token, TokenUser, tokenuser, retlen, &retlen))
974 bail(
"could not get token information: error code %lu",
978 if (!LookupAccountSid(NULL, tokenuser->User.Sid, accountname, &accountnamesize,
979 domainname, &domainnamesize, &accountnameuse))
981 bail(
"could not look up account SID: error code %lu",
1000config_sspi_auth(
const char *pgdata,
const char *superuser_name)
1002 const char *accountname,
1013 current_windows_user(&accountname, &domainname);
1016 if (superuser_name == NULL)
1026 if (superuser_name == NULL)
1037 struct addrinfo *gai_result;
1038 struct addrinfo hints;
1041 hints.ai_flags = AI_NUMERICHOST;
1042 hints.ai_family = AF_UNSPEC;
1043 hints.ai_socktype = 0;
1044 hints.ai_protocol = 0;
1045 hints.ai_addrlen = 0;
1046 hints.ai_canonname = NULL;
1047 hints.ai_addr = NULL;
1048 hints.ai_next = NULL;
1050 have_ipv6 = (WSAStartup(MAKEWORD(2, 2), &wsaData) == 0 &&
1051 getaddrinfo(
"::1", NULL, &hints, &gai_result) == 0);
1058 bail("could not write to file \"%s\": %m", fname); \
1061 res =
snprintf(fname,
sizeof(fname),
"%s/pg_hba.conf", pgdata);
1062 if (res < 0 || res >=
sizeof(fname))
1068 bail(
"directory name too long");
1070 hba = fopen(fname,
"w");
1073 bail(
"could not open file \"%s\" for writing: %m", fname);
1075 CW(fputs(
"# Configuration written by config_sspi_auth()\n", hba) >= 0);
1076 CW(fputs(
"host all all 127.0.0.1/32 sspi include_realm=1 map=regress\n",
1079 CW(fputs(
"host all all ::1/128 sspi include_realm=1 map=regress\n",
1081 CW(fclose(hba) == 0);
1083 snprintf(fname,
sizeof(fname),
"%s/pg_ident.conf", pgdata);
1084 ident = fopen(fname,
"w");
1087 bail(
"could not open file \"%s\" for writing: %m", fname);
1089 CW(fputs(
"# Configuration written by config_sspi_auth()\n",
ident) >= 0);
1097 accountname, domainname, fmtHba(superuser_name)) >= 0);
1100 accountname, domainname, fmtHba(sl->
str)) >= 0);
1101 CW(fclose(
ident) == 0);
1121 "\"%s%spsql\" -X -q",
1152 for (cmdptr = cmdbuf.
data; *cmdptr; cmdptr++)
1154 if (strchr(
"\\\"$`", *cmdptr))
1174 if (system(
buf->data) != 0)
1177 bail(
"command failed: %s",
buf->data);
1187#define psql_command(database, ...) \
1189 StringInfo cmdbuf = psql_start_command(); \
1190 psql_add_command(cmdbuf, __VA_ARGS__); \
1191 psql_end_command(cmdbuf, database); \
1217 bail(
"could not fork: %m");
1230 cmdline2 =
psprintf(
"exec %s", cmdline);
1238 PROCESS_INFORMATION pi;
1240 const char *comspec;
1243 comspec = getenv(
"COMSPEC");
1244 if (comspec == NULL)
1247 memset(&pi, 0,
sizeof(pi));
1248 cmdline2 =
psprintf(
"\"%s\" /c \"%s\"", comspec, cmdline);
1250 if (!CreateRestrictedProcess(cmdline2, &pi))
1253 CloseHandle(pi.hThread);
1265 FILE *f = fopen(file,
"r");
1269 diag(
"could not open file \"%s\" for reading: %m", file);
1272 fseek(f, 0, SEEK_END);
1286 FILE *f = fopen(file,
"r");
1290 diag(
"could not open file \"%s\" for reading: %m", file);
1293 while ((
c = fgetc(f)) != EOF)
1305 FILE *f = fopen(file,
"r");
1318 if (
stat(dir, &st) != 0)
1330 bail(
"could not create directory \"%s\": %m", dir);
1340 int ssize = strlen(expectfile) + 2 + 1;
1344 if (!(tmp = (
char *)
malloc(ssize)))
1347 if (!(s = (
char *)
malloc(ssize)))
1353 strcpy(tmp, expectfile);
1354 last_dot = strrchr(tmp,
'.');
1362 snprintf(s, ssize,
"%s_%d.%s", tmp,
i, last_dot + 1);
1379 bail(
"diff command failed with status %d: %s", r, cmd);
1389 bail(
"diff command not found: %s", cmd);
1403results_differ(
const char *testname,
const char *resultsfile,
const char *default_expectfile)
1410 int best_line_count;
1413 const char *platform_expectfile;
1421 strlcpy(expectfile, default_expectfile,
sizeof(expectfile));
1422 if (platform_expectfile)
1428 char *p = strrchr(expectfile,
'/');
1431 strcpy(++p, platform_expectfile);
1435 snprintf(diff,
sizeof(diff),
"%s.diff", resultsfile);
1439 "diff %s \"%s\" \"%s\" > \"%s\"",
1451 strcpy(best_expect_file, expectfile);
1453 for (
i = 0;
i <= 9;
i++)
1455 char *alt_expectfile;
1458 if (!alt_expectfile)
1459 bail(
"Unable to check secondary comparison files: %m");
1463 free(alt_expectfile);
1468 "diff %s \"%s\" \"%s\" > \"%s\"",
1474 free(alt_expectfile);
1479 if (l < best_line_count)
1482 best_line_count = l;
1483 strlcpy(best_expect_file, alt_expectfile,
sizeof(best_expect_file));
1485 free(alt_expectfile);
1493 if (platform_expectfile)
1496 "diff %s \"%s\" \"%s\" > \"%s\"",
1507 if (l < best_line_count)
1510 best_line_count = l;
1511 strlcpy(best_expect_file, default_expectfile,
sizeof(best_expect_file));
1532 "diff %s \"%s\" \"%s\" >> \"%s\"",
1550 char **names,
int num_tests)
1558 memcpy(active_pids, pids, num_tests *
sizeof(
PID_TYPE));
1561 tests_left = num_tests;
1562 while (tests_left > 0)
1569 p = wait(&exit_status);
1572 bail(
"failed to wait for subprocesses: %m");
1577 r = WaitForMultipleObjects(tests_left, active_pids, FALSE, INFINITE);
1578 if (r < WAIT_OBJECT_0 || r >= WAIT_OBJECT_0 + tests_left)
1580 bail(
"failed to wait for subprocesses: error code %lu",
1583 p = active_pids[r - WAIT_OBJECT_0];
1585 active_pids[r - WAIT_OBJECT_0] = active_pids[tests_left - 1];
1588 for (
i = 0;
i < num_tests;
i++)
1593 GetExitCodeProcess(pids[
i], &exit_status);
1594 CloseHandle(pids[
i]);
1597 statuses[
i] = (int) exit_status;
1619 diag(
"(test process exited with exit code %d)",
1624 diag(
"(test process was terminated by exception 0x%X)",
1627 diag(
"(test process was terminated by signal %d: %s)",
1632 diag(
"(test process exited with unrecognized status %d)", exitstatus);
1642#define MAX_PARALLEL_TESTS 100
1655 memset(tests, 0,
sizeof(tests));
1656 memset(resultfiles, 0,
sizeof(resultfiles));
1657 memset(expectfiles, 0,
sizeof(expectfiles));
1658 memset(tags, 0,
sizeof(tags));
1660 scf = fopen(schedule,
"r");
1662 bail(
"could not open file \"%s\" for reading: %m", schedule);
1664 while (fgets(scbuf,
sizeof(scbuf), scf))
1676 while (
i > 0 && isspace((
unsigned char) scbuf[
i - 1]))
1679 if (scbuf[0] ==
'\0' || scbuf[0] ==
'#')
1681 if (strncmp(scbuf,
"test: ", 6) == 0)
1685 bail(
"syntax error in schedule file \"%s\" line %d: %s",
1686 schedule, line_num, scbuf);
1693 if (*
c ==
'\0' || isspace((
unsigned char) *
c))
1702 bail(
"too many parallel tests (more than %d) in schedule file \"%s\" line %d: %s",
1725 bail(
"syntax error in schedule file \"%s\" line %d: %s",
1726 schedule, line_num, scbuf);
1731 pids[0] = (startfunc) (tests[0], &resultfiles[0], &expectfiles[0], &tags[0]);
1738 bail(
"too many parallel tests (more than %d) in schedule file \"%s\" line %d: %s",
1745 note_detail(
"parallel group (%d tests, in groups of %d): ",
1747 for (
i = 0;
i < num_tests;
i++)
1753 tests + oldest,
i - oldest);
1756 pids[
i] = (startfunc) (tests[
i], &resultfiles[
i], &expectfiles[
i], &tags[
i]);
1761 tests + oldest,
i - oldest);
1766 note_detail(
"parallel group (%d tests): ", num_tests);
1767 for (
i = 0;
i < num_tests;
i++)
1769 pids[
i] = (startfunc) (tests[
i], &resultfiles[
i], &expectfiles[
i], &tags[
i]);
1777 for (
i = 0;
i < num_tests;
i++)
1782 bool differ =
false;
1793 for (rl = resultfiles[
i], el = expectfiles[
i], tl = tags[
i];
1796 tl = tl ? tl->
next : NULL)
1801 (*postfunc) (rl->
str);
1810 if (statuses[
i] != 0)
1828 for (
i = 0;
i < num_tests;
i++)
1858 bool differ =
false;
1860 pid = (startfunc) (
test, &resultfiles, &expectfiles, &tags);
1871 for (rl = resultfiles, el = expectfiles, tl = tags;
1874 tl = tl ? tl->
next : NULL)
1879 (*postfunc) (rl->
str);
1890 if (exit_status != 0)
1972 "ALTER DATABASE \"%s\" SET lc_messages TO 'C';"
1973 "ALTER DATABASE \"%s\" SET lc_monetary TO 'C';"
1974 "ALTER DATABASE \"%s\" SET lc_numeric TO 'C';"
1975 "ALTER DATABASE \"%s\" SET lc_time TO 'C';"
1976 "ALTER DATABASE \"%s\" SET bytea_output TO 'hex';"
1977 "ALTER DATABASE \"%s\" SET timezone_abbreviations TO 'Default';",
2006 for (; granted_dbs != NULL; granted_dbs = granted_dbs->
next)
2009 granted_dbs->
str, rolename);
2017 printf(
_(
"PostgreSQL regression test driver\n"));
2022 printf(
_(
" --bindir=BINPATH use BINPATH for programs that are run;\n"));
2023 printf(
_(
" if empty, use PATH from the environment\n"));
2024 printf(
_(
" --config-auth=DATADIR update authentication settings for DATADIR\n"));
2025 printf(
_(
" --create-role=ROLE create the specified role before testing\n"));
2026 printf(
_(
" --dbname=DB use database DB (default \"regression\")\n"));
2027 printf(
_(
" --debug turn on debug mode in programs that are run\n"));
2028 printf(
_(
" --dlpath=DIR look for dynamic libraries in DIR\n"));
2029 printf(
_(
" --encoding=ENCODING use ENCODING as the encoding\n"));
2030 printf(
_(
" --expecteddir=DIR take expected files from DIR (default \".\")\n"));
2031 printf(
_(
" -h, --help show this help, then exit\n"));
2032 printf(
_(
" --inputdir=DIR take input files from DIR (default \".\")\n"));
2033 printf(
_(
" --launcher=CMD use CMD as launcher of psql\n"));
2034 printf(
_(
" --load-extension=EXT load the named extension before running the\n"));
2035 printf(
_(
" tests; can appear multiple times\n"));
2036 printf(
_(
" --max-connections=N maximum number of concurrent connections\n"));
2037 printf(
_(
" (default is 0, meaning unlimited)\n"));
2038 printf(
_(
" --max-concurrent-tests=N maximum number of concurrent tests in schedule\n"));
2039 printf(
_(
" (default is 0, meaning unlimited)\n"));
2040 printf(
_(
" --outputdir=DIR place output files in DIR (default \".\")\n"));
2041 printf(
_(
" --schedule=FILE use test ordering schedule from FILE\n"));
2042 printf(
_(
" (can be used multiple times to concatenate)\n"));
2043 printf(
_(
" --temp-instance=DIR create a temporary instance in DIR\n"));
2044 printf(
_(
" --use-existing use an existing installation\n"));
2045 printf(
_(
" -V, --version output version information, then exit\n"));
2047 printf(
_(
"Options for \"temp-instance\" mode:\n"));
2048 printf(
_(
" --no-locale use C locale\n"));
2049 printf(
_(
" --port=PORT start postmaster on PORT\n"));
2050 printf(
_(
" --temp-config=FILE append contents of FILE to temporary config\n"));
2052 printf(
_(
"Options for using an existing installation:\n"));
2053 printf(
_(
" --host=HOST use postmaster running on HOST\n"));
2054 printf(
_(
" --port=PORT use postmaster running at PORT\n"));
2055 printf(
_(
" --user=USER connect as USER\n"));
2057 printf(
_(
"The exit status is 0 if all tests passed, 1 if some tests failed, and 2\n"));
2058 printf(
_(
"if the tests could not be run for some reason.\n"));
2060 printf(
_(
"Report bugs to <%s>.\n"), PACKAGE_BUGREPORT);
2061 printf(
_(
"%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
2070 static struct option long_options[] = {
2098 bool use_unix_sockets;
2119 use_unix_sockets = getenv(
"PG_TEST_USE_UNIX_SOCKETS") ?
true :
false;
2121 use_unix_sockets =
true;
2124 if (!use_unix_sockets)
2133 if (getenv(
"PG_REGRESS_DIFF_OPTS"))
2136 while ((
c =
getopt_long(argc, argv,
"hV", long_options, &option_index)) != -1)
2144 puts(
"pg_regress (PostgreSQL) " PG_VERSION);
2234 while (argc -
optind >= 1)
2246 bail(
"no database name was specified");
2252 if (!use_unix_sockets)
2267 port = 0xC000 | (PG_VERSION_NUM & 0x3FFF);
2281#if defined(HAVE_GETRLIMIT)
2289 const char *env_wait;
2291 const char *initdb_template_dir;
2295 const char *initdb_extra_opts_env;
2317 initdb_extra_opts_env = getenv(
"PG_TEST_INITDB_EXTRA_OPTS");
2330 initdb_template_dir = getenv(
"INITDB_TEMPLATE");
2331 if (initdb_template_dir == NULL ||
nolocale ||
debug || initdb_extra_opts_env)
2333 note(
"initializing database system by running initdb");
2336 "\"%s%sinitdb\" -D \"%s/data\" --no-clean --no-sync",
2344 if (initdb_extra_opts_env)
2348 if (system(cmd.
data))
2350 bail(
"initdb failed\n"
2351 "# Examine \"%s/log/initdb.log\" for the reason.\n"
2352 "# Command was: %s",
2359 const char *copycmd =
"cp -RPp \"%s\" \"%s/data\"";
2360 int expected_exitcode = 0;
2362 const char *copycmd =
"robocopy /E /NJS /NJH /NFL /NDL /NP \"%s\" \"%s/data\"";
2363 int expected_exitcode = 1;
2366 note(
"initializing database system by copying initdb template");
2370 initdb_template_dir,
2374 if (system(cmd.
data) != expected_exitcode)
2376 bail(
"copying of initdb template failed\n"
2377 "# Examine \"%s/log/initdb.log\" for the reason.\n"
2378 "# Command was: %s",
2394 pg_conf = fopen(
buf,
"a");
2395 if (pg_conf == NULL)
2396 bail(
"could not open \"%s\" for adding extra config: %m",
buf);
2398 fputs(
"\n# Configuration added by pg_regress\n\n", pg_conf);
2399 fputs(
"log_autovacuum_min_duration = 0\n", pg_conf);
2400 fputs(
"log_checkpoints = on\n", pg_conf);
2401 fputs(
"log_line_prefix = '%m %b[%p] %q%a '\n", pg_conf);
2402 fputs(
"log_lock_waits = on\n", pg_conf);
2403 fputs(
"log_temp_files = 128kB\n", pg_conf);
2404 fputs(
"max_prepared_transactions = 2\n", pg_conf);
2408 char *temp_config = sl->
str;
2410 char line_buf[1024];
2412 extra_conf = fopen(temp_config,
"r");
2413 if (extra_conf == NULL)
2415 bail(
"could not open \"%s\" to read extra config: %m",
2418 while (fgets(line_buf,
sizeof(line_buf), extra_conf) != NULL)
2419 fputs(line_buf, pg_conf);
2426 if (!use_unix_sockets)
2433 config_sspi_auth(
buf, NULL);
2454 for (
i = 0;
i < 16;
i++)
2462 note(
"port %d apparently in use",
port);
2464 note(
"could not determine an available port");
2465 bail(
"Specify an unused port using the --port option or shut down any conflicting PostgreSQL servers.");
2468 note(
"port %d apparently in use, trying %d",
port,
port + 1);
2481 "\"%s%spostgres\" -D \"%s/data\" -F%s "
2482 "-c \"listen_addresses=%s\" -k \"%s\" "
2483 "> \"%s/log/postmaster.log\" 2>&1",
2491 bail(
"could not spawn postmaster: %m");
2500 env_wait = getenv(
"PGCTLTIMEOUT");
2501 if (env_wait != NULL)
2526 bail(
"attempting to connect to postmaster failed");
2537 bail(
"postmaster failed, examine \"%s/log/postmaster.log\" for the reason",
2543 diag(
"postmaster did not respond within %d seconds, examine \"%s/log/postmaster.log\" for the reason",
2554 bail(
"could not kill failed postmaster: %m");
2557 bail(
"could not kill failed postmaster: error code %lu",
2560 bail(
"postmaster failed");
2567#define ULONGPID(x) (unsigned long) (unsigned long long) (x)
2569#define ULONGPID(x) (unsigned long) (x)
2571 note(
"using temp instance on port %d with PID %lu",
2629 diag(
"could not remove temp instance \"%s\"",
2648 diag(
"The differences that caused some tests to fail can be viewed in the file \"%s\".",
2650 diag(
"A copy of the test summary that you see above is saved in the file \"%s\".",
static Datum values[MAXATTR]
#define Assert(condition)
#define PG_TEXTDOMAIN(domain)
#define pg_attribute_printf(f, a)
void set_pglocale_pgservice(const char *argv0, const char *app)
#define fprintf(file, fmt, msg)
static void PGresult * res
PGPing PQpingParams(const char *const *keywords, const char *const *values, int expand_dbname)
void * pg_malloc(size_t size)
char * pg_strdup(const char *in)
void * pg_realloc(void *ptr, 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)
#define INSTR_TIME_GET_MILLISEC(t)
static const JsonPathKeyword keywords[]
static void const char * fmt
static void const char fflush(stdout)
vfprintf(stderr, fmt, args)
void pg_logging_init(const char *argv0)
#define pg_log_error_hint(...)
void pfree(void *pointer)
#define DEFAULT_PGSOCKET_DIR
PGDLLIMPORT char * optarg
static void open_result_files(void)
static int max_connections
static bool port_specified_by_user
static int file_line_count(const char *file)
static char * get_alternative_expectfile(const char *expectfile, int i)
static void load_resultmap(void)
static void psql_add_command(StringInfo buf, const char *query,...) pg_attribute_printf(2
static void static void static void static StringInfo psql_start_command(void)
bool file_exists(const char *file)
static void signal_remove_temp(SIGNAL_ARGS)
static void remove_temp(void)
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 const char * get_expectfile(const char *testname, const char *file)
static void static void psql_end_command(StringInfo buf, const char *database)
static void static void emit_tap_output(TAPtype type, const char *fmt,...) pg_attribute_printf(2
static StringInfo failed_tests
static void unlimit_core_size(void)
static const char * temp_sockdir
static bool directory_exists(const char *dir)
static _stringlist * schedulelist
#define WAIT_TICKS_PER_SECOND
static _stringlist * loadextension
static char * logfilename
static _stringlist * temp_configs
static _stringlist * extra_tests
static void test_status_ok(const char *testname, double runtime, bool parallel)
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)
#define bail_noatexit(...)
static char * difffilename
static void bail_out(bool noatexit, const char *fmt,...) pg_attribute_printf(2
static const char * make_temp_sockdir(void)
static _resultmap * resultmap
struct _resultmap _resultmap
static char * config_auth_datadir
static void drop_database_if_exists(const char *dbname)
static void test_status_failed(const char *testname, double runtime, bool parallel)
const char * basic_diff_opts
static void initialize_environment(void)
static char * temp_instance
static char sockself[MAXPGPATH]
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 bool postmaster_running
static char socklock[MAXPGPATH]
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 test_status_print(bool ok, const char *testname, double runtime, bool parallel)
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 void static void static void emit_tap_output_v(TAPtype type, const char *fmt, va_list argp) pg_attribute_printf(2
#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)
static const char * pghost
static const char * pgport
char * strsep(char **stringp, const char *delim)
const char * pg_strsignal(int signum)
pqsigfunc pqsignal(int signo, pqsigfunc func)
char * make_absolute_path(const char *path)
char * mkdtemp(char *path)
const char * get_progname(const char *argv0)
size_t strlcpy(char *dst, const char *src, size_t siz)
#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)
int appendStringInfoVA(StringInfo str, const char *fmt, va_list args)
void destroyStringInfo(StringInfo str)
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
const char * get_user_name(char **errstr)