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-2024, 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;
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 *expecteddir;
57 extern char *launcher;
58 
59 extern const char *basic_diff_opts;
60 extern const char *pretty_diff_opts;
61 
62 int regression_main(int argc, char *argv[],
63  init_function ifunc,
64  test_start_function startfunc,
66 
67 void add_stringlist_item(_stringlist **listhead, const char *str);
68 PID_TYPE spawn_process(const char *cmdline);
69 bool file_exists(const char *file);
static char * filename
Definition: pg_dumpall.c:121
bool file_exists(const char *file)
Definition: pg_regress.c:1301
void(* init_function)(int argc, char **argv)
Definition: pg_regress.h:35
#define PID_TYPE
Definition: pg_regress.h:14
bool debug
Definition: pg_regress.c:99
PID_TYPE(* test_start_function)(const char *testname, _stringlist **resultfiles, _stringlist **expectfiles, _stringlist **tags)
Definition: pg_regress.h:38
struct _stringlist _stringlist
char * outputdir
Definition: pg_regress.c:101
char * libdir
char * launcher
Definition: pg_regress.c:104
const char * pretty_diff_opts
Definition: pg_regress.c:66
char * inputdir
Definition: pg_regress.c:100
int regression_main(int argc, char *argv[], init_function ifunc, test_start_function startfunc, postprocess_result_function postfunc)
Definition: pg_regress.c:2078
char * expecteddir
Definition: pg_regress.c:102
char * host_platform
Definition: pg_regress.c:53
const char * basic_diff_opts
Definition: pg_regress.c:65
void(* postprocess_result_function)(const char *filename)
Definition: pg_regress.h:44
char * datadir
_stringlist * dblist
Definition: pg_regress.c:98
PID_TYPE spawn_process(const char *cmdline)
Definition: pg_regress.c:1196
char * bindir
Definition: pg_regress.c:103
void add_stringlist_item(_stringlist **listhead, const char *str)
Definition: pg_regress.c:198
char * str
Definition: initdb.c:92
struct _stringlist * next
Definition: initdb.c:93