40 s = fopen(sourcefile,
"r");
43 fprintf(stderr,
"Could not open file %s for reading\n", sourcefile);
58 if (strstr(linebuf.
data,
"#line ") == linebuf.
data)
60 char *p = strchr(linebuf.
data,
'"');
63 while (*p && (*(p + plen) ==
'.' || strchr(p + plen,
'/') != NULL))
70 memmove(p + 1, p + plen, strlen(p + plen) + 1);
74 fputs(linebuf.
data, t);
99 s = fopen(resultfile,
"r");
102 fprintf(stderr,
"Could not open file %s for reading\n", resultfile);
105 t = fopen(tmpfile,
"w");
108 fprintf(stderr,
"Could not open file %s for writing\n", tmpfile);
116 char *p1 = strstr(linebuf.
data,
"connection to server ");
120 char *
p2 = strstr(p1,
"failed: ");
124 memmove(p1 + 21,
p2, strlen(
p2) + 1);
128 fputs(linebuf.
data, t);
134 if (rename(tmpfile, resultfile) != 0)
136 fprintf(stderr,
"Could not overwrite file %s with %s\n",
137 resultfile, tmpfile);
172 for (
char *
c = testname_dash.
data; *
c !=
'\0';
c++)
178 snprintf(expectfile_stdout,
sizeof(expectfile_stdout),
179 "%s/expected/%s.stdout",
181 snprintf(expectfile_stderr,
sizeof(expectfile_stderr),
182 "%s/expected/%s.stderr",
184 snprintf(expectfile_source,
sizeof(expectfile_source),
188 snprintf(outfile_stdout,
sizeof(outfile_stdout),
189 "%s/results/%s.stdout",
191 snprintf(outfile_stderr,
sizeof(outfile_stderr),
192 "%s/results/%s.stderr",
194 snprintf(outfile_source,
sizeof(outfile_source),
213 "\"%s\" >\"%s\" 2>\"%s\"",
219 setenv(
"PGAPPNAME", appnameenv, 1);
226 fprintf(stderr,
_(
"could not start process for test %s\n"),
244 if (nlen > 7 && strcmp(
filename + nlen - 7,
".stderr") == 0)
static void PGresult const char * p2
static void add_stringlist_item(_stringlist **listhead, const char *str)
void pfree(void *pointer)
bool pg_get_line_buf(FILE *stream, StringInfo buf)
int regression_main(int argc, char *argv[], init_function ifunc, test_start_function startfunc, postprocess_result_function postfunc)
PID_TYPE spawn_process(const char *cmdline)
int main(int argc, char *argv[])
static void ecpg_init(int argc, char *argv[])
static void ecpg_postprocess_result(const char *filename)
static void ecpg_filter_stderr(const char *resultfile, const char *tmpfile)
static void ecpg_filter_source(const char *sourcefile, const char *outfile)
static PID_TYPE ecpg_start_test(const char *testname, _stringlist **resultfiles, _stringlist **expectfiles, _stringlist **tags)
char * psprintf(const char *fmt,...)
void appendStringInfoString(StringInfo str, const char *s)
void initStringInfo(StringInfo str)