2007-06-12 13:07:34 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* pg_regress.h --- regression test driver
|
|
|
|
*
|
2023-01-02 21:00:37 +01:00
|
|
|
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
|
2007-06-12 13:07:34 +02:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
2010-09-20 22:08:53 +02:00
|
|
|
* src/test/regress/pg_regress.h
|
2007-06-12 13:07:34 +02:00
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#ifndef WIN32
|
|
|
|
#define PID_TYPE pid_t
|
|
|
|
#define INVALID_PID (-1)
|
|
|
|
#else
|
|
|
|
#define PID_TYPE HANDLE
|
|
|
|
#define INVALID_PID INVALID_HANDLE_VALUE
|
|
|
|
#endif
|
|
|
|
|
2020-09-06 20:13:02 +02:00
|
|
|
struct StringInfoData; /* avoid including stringinfo.h here */
|
|
|
|
|
2007-06-12 13:07:34 +02:00
|
|
|
/* simple list of strings */
|
|
|
|
typedef struct _stringlist
|
|
|
|
{
|
|
|
|
char *str;
|
|
|
|
struct _stringlist *next;
|
|
|
|
} _stringlist;
|
|
|
|
|
2021-01-11 19:43:19 +01:00
|
|
|
/*
|
|
|
|
* Callback function signatures for test programs that use regression_main()
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Initialize at program start */
|
2013-11-08 20:40:41 +01:00
|
|
|
typedef void (*init_function) (int argc, char **argv);
|
2007-06-12 13:07:34 +02:00
|
|
|
|
2021-01-11 19:43:19 +01:00
|
|
|
/* Launch one test case */
|
|
|
|
typedef PID_TYPE(*test_start_function) (const char *testname,
|
|
|
|
_stringlist **resultfiles,
|
|
|
|
_stringlist **expectfiles,
|
|
|
|
_stringlist **tags);
|
|
|
|
|
|
|
|
/* Postprocess one result file (optional) */
|
|
|
|
typedef void (*postprocess_result_function) (const char *filename);
|
|
|
|
|
|
|
|
|
2007-06-12 13:07:34 +02:00
|
|
|
extern char *bindir;
|
|
|
|
extern char *libdir;
|
|
|
|
extern char *datadir;
|
|
|
|
extern char *host_platform;
|
|
|
|
|
|
|
|
extern _stringlist *dblist;
|
|
|
|
extern bool debug;
|
|
|
|
extern char *inputdir;
|
|
|
|
extern char *outputdir;
|
2022-08-20 19:59:01 +02:00
|
|
|
extern char *expecteddir;
|
2011-01-24 02:44:48 +01:00
|
|
|
extern char *launcher;
|
2007-11-15 22:14:46 +01:00
|
|
|
|
2007-06-12 13:07:34 +02:00
|
|
|
extern const char *basic_diff_opts;
|
|
|
|
extern const char *pretty_diff_opts;
|
|
|
|
|
|
|
|
int regression_main(int argc, char *argv[],
|
2021-01-11 19:43:19 +01:00
|
|
|
init_function ifunc,
|
|
|
|
test_start_function startfunc,
|
|
|
|
postprocess_result_function postfunc);
|
|
|
|
|
2007-06-12 13:07:34 +02:00
|
|
|
void add_stringlist_item(_stringlist **listhead, const char *str);
|
|
|
|
PID_TYPE spawn_process(const char *cmdline);
|
2008-10-02 00:38:57 +02:00
|
|
|
bool file_exists(const char *file);
|