Definition at line 1985 of file pg_regress.c.
1990 static struct option long_options[] = {
2018 bool use_unix_sockets;
2040 use_unix_sockets = getenv(
"PG_TEST_USE_UNIX_SOCKETS") ?
true :
false;
2042 use_unix_sockets =
true;
2045 if (!use_unix_sockets)
2054 if (getenv(
"PG_REGRESS_DIFF_OPTS"))
2057 while ((
c =
getopt_long(argc, argv,
"hV", long_options, &option_index)) != -1)
2065 puts(
"pg_regress (PostgreSQL) " PG_VERSION);
2146 fprintf(stderr,
_(
"\nTry \"%s -h\" for more information.\n"),
2155 while (argc -
optind >= 1)
2167 fprintf(stderr,
_(
"%s: no database name was specified\n"),
2175 if (!use_unix_sockets)
2190 port = 0xC000 | (PG_VERSION_NUM & 0x3FFF);
2204 #if defined(HAVE_GETRLIMIT)
2211 const char *env_wait;
2220 header(
_(
"removing existing temp instance"));
2223 fprintf(stderr,
_(
"\n%s: could not remove temp instance \"%s\"\n"),
2229 header(
_(
"creating temporary instance"));
2240 header(
_(
"initializing database system"));
2242 "\"%s%sinitdb\" -D \"%s/data\" --no-clean --no-sync%s%s > \"%s/log/initdb.log\" 2>&1",
2246 debug ?
" --debug" :
"",
2265 pg_conf = fopen(
buf,
"a");
2266 if (pg_conf == NULL)
2271 fputs(
"\n# Configuration added by pg_regress\n\n", pg_conf);
2272 fputs(
"log_autovacuum_min_duration = 0\n", pg_conf);
2273 fputs(
"log_checkpoints = on\n", pg_conf);
2274 fputs(
"log_line_prefix = '%m %b[%p] %q%a '\n", pg_conf);
2275 fputs(
"log_lock_waits = on\n", pg_conf);
2276 fputs(
"log_temp_files = 128kB\n", pg_conf);
2277 fputs(
"max_prepared_transactions = 2\n", pg_conf);
2281 char *temp_config = sl->
str;
2283 char line_buf[1024];
2285 extra_conf = fopen(temp_config,
"r");
2286 if (extra_conf == NULL)
2288 fprintf(stderr,
_(
"\n%s: could not open \"%s\" to read extra config: %s\n"),
progname, temp_config,
strerror(errno));
2291 while (fgets(line_buf,
sizeof(line_buf), extra_conf) != NULL)
2292 fputs(line_buf, pg_conf);
2299 if (!use_unix_sockets)
2306 config_sspi_auth(
buf, NULL);
2314 "\"%s%spsql\" -X postgres <%s 2>%s",
2319 for (
i = 0;
i < 16;
i++)
2322 if (system(buf2) == 0)
2328 fprintf(stderr,
_(
"port %d apparently in use\n"),
port);
2330 fprintf(stderr,
_(
"%s: could not determine an available port\n"),
progname);
2331 fprintf(stderr,
_(
"Specify an unused port using the --port option or shut down any conflicting PostgreSQL servers.\n"));
2335 fprintf(stderr,
_(
"port %d apparently in use, trying %d\n"),
port,
port + 1);
2347 header(
_(
"starting postmaster"));
2349 "\"%s%spostgres\" -D \"%s/data\" -F%s "
2350 "-c \"listen_addresses=%s\" -k \"%s\" "
2351 "> \"%s/log/postmaster.log\" 2>&1",
2360 fprintf(stderr,
_(
"\n%s: could not spawn postmaster: %s\n"),
2372 env_wait = getenv(
"PGCTLTIMEOUT");
2373 if (env_wait != NULL)
2386 if (system(buf2) == 0)
2406 fprintf(stderr,
_(
"\n%s: postmaster did not respond within %d seconds\nExamine %s/log/postmaster.log for the reason\n"),
2418 fprintf(stderr,
_(
"\n%s: could not kill failed postmaster: %s\n"),
2422 fprintf(stderr,
_(
"\n%s: could not kill failed postmaster: error code %lu\n"),
2433 #define ULONGPID(x) (unsigned long) (unsigned long long) (x)
2435 #define ULONGPID(x) (unsigned long) (x)
2437 printf(
_(
"running on port %d with PID %lu\n"),
2469 header(
_(
"running regression test queries"));
2486 header(
_(
"shutting down postmaster"));
2497 header(
_(
"removing temporary instance"));
2499 fprintf(stderr,
_(
"\n%s: could not remove temp instance \"%s\"\n"),
2510 _(
" All %d tests passed. "),
2514 _(
" %d of %d tests failed. "),
2519 for (
i = strlen(
buf);
i > 0;
i--)
2522 for (
i = strlen(
buf);
i > 0;
i--)
2529 printf(
_(
"The differences that caused some tests to fail can be viewed in the\n"
2530 "file \"%s\". A copy of the test summary that you see\n"
2531 "above is saved in the file \"%s\".\n\n"),
#define PG_TEXTDOMAIN(domain)
void set_pglocale_pgservice(const char *argv0, const char *app)
int getopt_long(int argc, char *const argv[], const char *optstring, const struct option *longopts, int *longindex)
#define required_argument
static void const char fflush(stdout)
void pg_logging_init(const char *argv0)
PGDLLIMPORT char * optarg
static void open_result_files(void)
static int max_connections
static bool port_specified_by_user
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)
static void unlimit_core_size(void)
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 void run_single_test(const char *test, test_start_function startfunc, postprocess_result_function postfunc)
const char * pretty_diff_opts
static char * difffilename
static void header(const char *fmt,...) pg_attribute_printf(1
static char * config_auth_datadir
static void drop_database_if_exists(const char *dbname)
static void initialize_environment(void)
static char * temp_instance
static const char * sockdir
static long file_size(const char *file)
static bool postmaster_running
static const char * progname
static _stringlist * extraroles
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 PID_TYPE postmaster_pid
char * make_absolute_path(const char *path)
const char * get_progname(const char *argv0)
void get_restricted_token(void)
bool rmtree(const char *path, bool rmtopdir)
void pg_usleep(long microsec)
References _, add_stringlist_item(), bindir, buf, config_auth_datadir, create_database(), create_role(), dblist, debug, DEVNULL, difffilename, directory_exists(), dlpath, drop_database_if_exists(), drop_role_if_exists(), encoding, exit(), expecteddir, extra_tests, extraroles, fail_count, fflush(), file_size(), fprintf, free_stringlist(), get_progname(), get_restricted_token(), getopt_long(), header(), help(), hostname, i, initialize_environment(), inputdir, INVALID_PID, kill, launcher, loadextension, logfile, logfilename, make_absolute_path(), make_directory(), max_concurrent_tests, max_connections, MAXPGPATH, _stringlist::next, no_argument, nolocale, open_result_files(), optarg, optind, outputdir, pg_logging_init(), pg_strdup(), PG_TEXTDOMAIN, pg_usleep(), port, port_specified_by_user, postmaster_pid, postmaster_running, pretty_diff_opts, printf, progname, required_argument, rmtree(), run_schedule(), run_single_test(), schedulelist, set_pglocale_pgservice(), setenv, SIGKILL, snprintf, sockdir, spawn_process(), split_to_stringlist(), sprintf, stop_postmaster(), _stringlist::str, strerror, success_count, temp_configs, temp_instance, true, ULONGPID, unlimit_core_size(), use_existing, user, and wait_seconds.
Referenced by main().