Update copyright for 2022
[pgsql.git] / src / test / regress / pg_regress.h
blob2143ee0e72734c2852064540421ba935bbc8978b
1 /*-------------------------------------------------------------------------
2 * pg_regress.h --- regression test driver
4 * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
5 * Portions Copyright (c) 1994, Regents of the University of California
7 * src/test/regress/pg_regress.h
8 *-------------------------------------------------------------------------
9 */
11 #include <unistd.h>
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
21 struct StringInfoData; /* avoid including stringinfo.h here */
23 /* simple list of strings */
24 typedef struct _stringlist
26 char *str;
27 struct _stringlist *next;
28 } _stringlist;
31 * Callback function signatures for test programs that use regression_main()
34 /* Initialize at program start */
35 typedef void (*init_function) (int argc, char **argv);
37 /* Launch one test case */
38 typedef PID_TYPE(*test_start_function) (const char *testname,
39 _stringlist **resultfiles,
40 _stringlist **expectfiles,
41 _stringlist **tags);
43 /* Postprocess one result file (optional) */
44 typedef void (*postprocess_result_function) (const char *filename);
47 extern char *bindir;
48 extern char *libdir;
49 extern char *datadir;
50 extern char *host_platform;
52 extern _stringlist *dblist;
53 extern bool debug;
54 extern char *inputdir;
55 extern char *outputdir;
56 extern char *launcher;
58 extern const char *basic_diff_opts;
59 extern const char *pretty_diff_opts;
61 int regression_main(int argc, char *argv[],
62 init_function ifunc,
63 test_start_function startfunc,
64 postprocess_result_function postfunc);
66 void add_stringlist_item(_stringlist **listhead, const char *str);
67 PID_TYPE spawn_process(const char *cmdline);
68 bool file_exists(const char *file);