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-2025, 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/* simple list of strings */
22typedef struct _stringlist
23{
24 char *str;
25 struct _stringlist *next;
27
28/*
29 * Callback function signatures for test programs that use regression_main()
30 */
31
32/* Initialize at program start */
33typedef void (*init_function) (int argc, char **argv);
34
35/* Launch one test case */
36typedef PID_TYPE(*test_start_function) (const char *testname,
37 _stringlist **resultfiles,
38 _stringlist **expectfiles,
39 _stringlist **tags);
40
41/* Postprocess one result file (optional) */
42typedef void (*postprocess_result_function) (const char *filename);
43
44
45extern char *bindir;
46extern char *libdir;
47extern char *datadir;
48extern char *host_platform;
49
50extern _stringlist *dblist;
51extern bool debug;
52extern char *inputdir;
53extern char *outputdir;
54extern char *expecteddir;
55extern char *launcher;
56
57extern const char *basic_diff_opts;
58extern const char *pretty_diff_opts;
59
60int regression_main(int argc, char *argv[],
61 init_function ifunc,
62 test_start_function startfunc,
64
65void add_stringlist_item(_stringlist **listhead, const char *str);
66PID_TYPE spawn_process(const char *cmdline);
67bool file_exists(const char *file);
const char * str
static char * filename
Definition: pg_dumpall.c:124
bool file_exists(const char *file)
Definition: pg_regress.c:1307
void(* init_function)(int argc, char **argv)
Definition: pg_regress.h:33
#define PID_TYPE
Definition: pg_regress.h:14
bool debug
Definition: pg_regress.c:98
PID_TYPE(* test_start_function)(const char *testname, _stringlist **resultfiles, _stringlist **expectfiles, _stringlist **tags)
Definition: pg_regress.h:36
struct _stringlist _stringlist
char * outputdir
Definition: pg_regress.c:100
char * libdir
char * launcher
Definition: pg_regress.c:103
const char * pretty_diff_opts
Definition: pg_regress.c:65
char * inputdir
Definition: pg_regress.c:99
int regression_main(int argc, char *argv[], init_function ifunc, test_start_function startfunc, postprocess_result_function postfunc)
Definition: pg_regress.c:2069
char * expecteddir
Definition: pg_regress.c:101
char * host_platform
Definition: pg_regress.c:52
const char * basic_diff_opts
Definition: pg_regress.c:64
void(* postprocess_result_function)(const char *filename)
Definition: pg_regress.h:42
char * datadir
_stringlist * dblist
Definition: pg_regress.c:97
PID_TYPE spawn_process(const char *cmdline)
Definition: pg_regress.c:1204
char * bindir
Definition: pg_regress.c:102
void add_stringlist_item(_stringlist **listhead, const char *str)
Definition: pg_regress.c:197
char * str
Definition: initdb.c:92
struct _stringlist * next
Definition: initdb.c:93