PostgreSQL Source Code  git master
pg_regress.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  * pg_regress.h --- regression test driver
3  *
4  * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
5  * Portions Copyright (c) 1994, Regents of the University of California
6  *
7  * src/test/regress/pg_regress.h
8  *-------------------------------------------------------------------------
9  */
10 
11 #include <unistd.h>
12 
13 #ifndef WIN32
14 #define PID_TYPE pid_t
15 #define INVALID_PID (-1)
16 #else
17 #define PID_TYPE HANDLE
18 #define INVALID_PID INVALID_HANDLE_VALUE
19 #endif
20 
21 struct StringInfoData; /* avoid including stringinfo.h here */
22 
23 /* simple list of strings */
24 typedef struct _stringlist
25 {
26  char *str;
27  struct _stringlist *next;
28 } _stringlist;
29 
30 /*
31  * Callback function signatures for test programs that use regression_main()
32  */
33 
34 /* Initialize at program start */
35 typedef void (*init_function) (int argc, char **argv);
36 
37 /* Launch one test case */
38 typedef PID_TYPE(*test_start_function) (const char *testname,
39  _stringlist **resultfiles,
40  _stringlist **expectfiles,
41  _stringlist **tags);
42 
43 /* Postprocess one result file (optional) */
44 typedef void (*postprocess_result_function) (const char *filename);
45 
46 
47 extern char *bindir;
48 extern char *libdir;
49 extern char *datadir;
50 extern char *host_platform;
51 
52 extern _stringlist *dblist;
53 extern bool debug;
54 extern char *inputdir;
55 extern char *outputdir;
56 extern char *launcher;
57 
58 extern const char *basic_diff_opts;
59 extern const char *pretty_diff_opts;
60 
61 int regression_main(int argc, char *argv[],
62  init_function ifunc,
63  test_start_function startfunc,
65 
66 void add_stringlist_item(_stringlist **listhead, const char *str);
67 PID_TYPE spawn_process(const char *cmdline);
68 void replace_string(struct StringInfoData *string,
69  const char *replace, const char *replacement);
70 bool file_exists(const char *file);
bool debug
Definition: pg_standby.c:47
void add_stringlist_item(_stringlist **listhead, const char *str)
Definition: pg_regress.c:157
char * str
Definition: pg_regress.h:26
void replace_string(struct StringInfoData *string, const char *replace, const char *replacement)
#define PID_TYPE
Definition: pg_regress.h:14
int regression_main(int argc, char *argv[], init_function ifunc, test_start_function startfunc, postprocess_result_function postfunc)
Definition: pg_regress.c:2092
char * libdir
const char * basic_diff_opts
Definition: pg_regress.c:67
void(* init_function)(int argc, char **argv)
Definition: pg_regress.h:35
char * inputdir
Definition: pg_regress.c:77
PID_TYPE spawn_process(const char *cmdline)
Definition: pg_regress.c:1158
char * datadir
struct _stringlist _stringlist
char * outputdir
Definition: pg_regress.c:78
const char * pretty_diff_opts
Definition: pg_regress.c:68
char * launcher
Definition: pg_regress.c:80
char * host_platform
Definition: pg_regress.c:55
_stringlist * dblist
Definition: pg_regress.c:75
static char * filename
Definition: pg_dumpall.c:91
void(* postprocess_result_function)(const char *filename)
Definition: pg_regress.h:44
struct _stringlist * next
Definition: pg_regress.h:27
PID_TYPE(* test_start_function)(const char *testname, _stringlist **resultfiles, _stringlist **expectfiles, _stringlist **tags)
Definition: pg_regress.h:38
char * bindir
Definition: pg_regress.c:79
bool file_exists(const char *file)
Definition: pg_regress.c:1268