mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-24 18:55:04 +08:00
Provide for a file specifying non-standard config options for temp install
for pg_regress, via --temp-config option. Pick this up in the make file via TEMP_CONFIG setting.
This commit is contained in:
parent
6bd4f401b0
commit
0cb74d3cec
@ -6,7 +6,7 @@
|
||||
# Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
|
||||
# Portions Copyright (c) 1994, Regents of the University of California
|
||||
#
|
||||
# $PostgreSQL: pgsql/src/test/regress/GNUmakefile,v 1.68 2007/06/12 11:07:32 mha Exp $
|
||||
# $PostgreSQL: pgsql/src/test/regress/GNUmakefile,v 1.69 2007/09/09 20:40:54 adunstan Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@ -19,6 +19,12 @@ contribdir = $(top_builddir)/contrib
|
||||
# port number for temp-installation test postmaster
|
||||
TEMP_PORT = 5$(DEF_PGPORT)
|
||||
|
||||
# file with extra config for temp build
|
||||
TEMP_CONF =
|
||||
ifdef TEMP_CONFIG
|
||||
TEMP_CONF += --temp-config=S(TEMP_CONFIG)
|
||||
endif
|
||||
|
||||
# where to find psql for testing an existing installation
|
||||
PSQLDIR = $(bindir)
|
||||
|
||||
@ -135,7 +141,7 @@ tablespace-setup:
|
||||
##
|
||||
|
||||
check: all
|
||||
./pg_regress --temp-install=./tmp_check --top-builddir=$(top_builddir) --srcdir=$(abs_srcdir) --temp-port=$(TEMP_PORT) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE)
|
||||
./pg_regress --temp-install=./tmp_check --top-builddir=$(top_builddir) --srcdir=$(abs_srcdir) --temp-port=$(TEMP_PORT) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE) $(TEMP_CONF)
|
||||
|
||||
installcheck: all
|
||||
./pg_regress --psqldir=$(PSQLDIR) --schedule=$(srcdir)/serial_schedule --srcdir=$(abs_srcdir) --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE)
|
||||
|
@ -11,7 +11,7 @@
|
||||
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.36 2007/07/18 21:19:17 alvherre Exp $
|
||||
* $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.37 2007/09/09 20:40:54 adunstan Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -76,6 +76,7 @@ static char *encoding = NULL;
|
||||
static _stringlist *schedulelist = NULL;
|
||||
static _stringlist *extra_tests = NULL;
|
||||
static char *temp_install = NULL;
|
||||
static char *temp_config = NULL;
|
||||
static char *top_builddir = NULL;
|
||||
static int temp_port = 65432;
|
||||
static bool nolocale = false;
|
||||
@ -1718,11 +1719,12 @@ help(void)
|
||||
printf(_(" (can be used multiple times to concatenate)\n"));
|
||||
printf(_(" --srcdir=DIR absolute path to source directory (for VPATH builds)\n"));
|
||||
printf(_(" --temp-install=DIR create a temporary installation in DIR\n"));
|
||||
printf(_(" --no-locale use C locale\n"));
|
||||
printf(_("\n"));
|
||||
printf(_("Options for \"temp-install\" mode:\n"));
|
||||
printf(_(" --no-locale use C locale\n"));
|
||||
printf(_(" --top-builddir=DIR (relative) path to top level build directory\n"));
|
||||
printf(_(" --temp-port=PORT port number to start temp postmaster on\n"));
|
||||
printf(_(" --temp-config=PATH append contents of PATH to temporary config\n"));
|
||||
printf(_("\n"));
|
||||
printf(_("Options for using an existing installation:\n"));
|
||||
printf(_(" --host=HOST use postmaster running on HOST\n"));
|
||||
@ -1766,6 +1768,7 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
|
||||
{"psqldir", required_argument, NULL, 16},
|
||||
{"srcdir", required_argument, NULL, 17},
|
||||
{"create-role", required_argument, NULL, 18},
|
||||
{"temp-config", required_argument, NULL, 19},
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
@ -1874,6 +1877,9 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
|
||||
case 18:
|
||||
split_to_stringlist(strdup(optarg), ", ", &extraroles);
|
||||
break;
|
||||
case 19:
|
||||
temp_config = strdup(optarg);
|
||||
break;
|
||||
default:
|
||||
/* getopt_long already emitted a complaint */
|
||||
fprintf(stderr, _("\nTry \"%s -h\" for more information.\n"),
|
||||
@ -1962,6 +1968,32 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
|
||||
exit_nicely(2);
|
||||
}
|
||||
|
||||
/* add any extra config specified to the postgresql.conf */
|
||||
if (temp_config != NULL)
|
||||
{
|
||||
FILE * extra_conf;
|
||||
FILE * pg_conf;
|
||||
char line_buf[1024];
|
||||
|
||||
snprintf(buf, sizeof(buf),"%s/data/postgresql.conf", temp_install);
|
||||
pg_conf = fopen(buf,"a");
|
||||
if (pg_conf == NULL)
|
||||
{
|
||||
fprintf(stderr, _("\n%s: could not open %s for adding extra config:\nError was %s\n"), progname, buf, strerror(errno));
|
||||
exit_nicely(2);
|
||||
}
|
||||
extra_conf = fopen(temp_config,"r");
|
||||
if (extra_conf == NULL)
|
||||
{
|
||||
fprintf(stderr, _("\n%s: could not open %s to read extra config:\nError was %s\n"), progname, buf, strerror(errno));
|
||||
exit_nicely(2);
|
||||
}
|
||||
while(fgets(line_buf, sizeof(line_buf),extra_conf) != NULL)
|
||||
fputs(line_buf, pg_conf);
|
||||
fclose(extra_conf);
|
||||
fclose(pg_conf);
|
||||
}
|
||||
|
||||
/*
|
||||
* Start the temp postmaster
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user