#include "pg_regress.h"
Go to the source code of this file.
Functions | |
static PID_TYPE | psql_start_test (const char *testname, _stringlist **resultfiles, _stringlist **expectfiles, _stringlist **tags) |
static void | psql_init (void) |
int | main (int argc, char *argv[]) |
int main | ( | int | argc, | |
char * | argv[] | |||
) |
Definition at line 94 of file pg_regress_main.c.
References psql_init(), psql_start_test(), and regression_main().
{ return regression_main(argc, argv, psql_init, psql_start_test); }
static void psql_init | ( | void | ) | [static] |
Definition at line 87 of file pg_regress_main.c.
References add_stringlist_item(), and dblist.
Referenced by main().
{ /* set default regression database name */ add_stringlist_item(&dblist, "regression"); }
static PID_TYPE psql_start_test | ( | const char * | testname, | |
_stringlist ** | resultfiles, | |||
_stringlist ** | expectfiles, | |||
_stringlist ** | tags | |||
) | [static] |
Definition at line 26 of file pg_regress_main.c.
References _, add_stringlist_item(), dblist, file_exists(), infile(), inputdir, INVALID_PID, launcher, MAXPGPATH, outputdir, PID_TYPE, psqldir, snprintf(), spawn_process(), _stringlist::str, and SYSTEMQUOTE.
Referenced by main().
{ PID_TYPE pid; char infile[MAXPGPATH]; char outfile[MAXPGPATH]; char expectfile[MAXPGPATH]; char psql_cmd[MAXPGPATH * 3]; size_t offset = 0; /* * Look for files in the output dir first, consistent with a vpath search. * This is mainly to create more reasonable error messages if the file is * not found. It also allows local test overrides when running pg_regress * outside of the source tree. */ snprintf(infile, sizeof(infile), "%s/sql/%s.sql", outputdir, testname); if (!file_exists(infile)) snprintf(infile, sizeof(infile), "%s/sql/%s.sql", inputdir, testname); snprintf(outfile, sizeof(outfile), "%s/results/%s.out", outputdir, testname); snprintf(expectfile, sizeof(expectfile), "%s/expected/%s.out", outputdir, testname); if (!file_exists(expectfile)) snprintf(expectfile, sizeof(expectfile), "%s/expected/%s.out", inputdir, testname); add_stringlist_item(resultfiles, outfile); add_stringlist_item(expectfiles, expectfile); if (launcher) offset += snprintf(psql_cmd + offset, sizeof(psql_cmd) - offset, "%s ", launcher); snprintf(psql_cmd + offset, sizeof(psql_cmd) - offset, SYSTEMQUOTE "\"%s%spsql\" -X -a -q -d \"%s\" < \"%s\" > \"%s\" 2>&1" SYSTEMQUOTE, psqldir ? psqldir : "", psqldir ? "/" : "", dblist->str, infile, outfile); pid = spawn_process(psql_cmd); if (pid == INVALID_PID) { fprintf(stderr, _("could not start process for test %s\n"), testname); exit(2); } return pid; }