Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0cb74d3

Browse files
committed
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.
1 parent 6bd4f40 commit 0cb74d3

File tree

2 files changed

+42
-4
lines changed

2 files changed

+42
-4
lines changed

src/test/regress/GNUmakefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
77
# Portions Copyright (c) 1994, Regents of the University of California
88
#
9-
# $PostgreSQL: pgsql/src/test/regress/GNUmakefile,v 1.68 2007/06/12 11:07:32 mha Exp $
9+
# $PostgreSQL: pgsql/src/test/regress/GNUmakefile,v 1.69 2007/09/09 20:40:54 adunstan Exp $
1010
#
1111
#-------------------------------------------------------------------------
1212

@@ -19,6 +19,12 @@ contribdir = $(top_builddir)/contrib
1919
# port number for temp-installation test postmaster
2020
TEMP_PORT = 5$(DEF_PGPORT)
2121

22+
# file with extra config for temp build
23+
TEMP_CONF =
24+
ifdef TEMP_CONFIG
25+
TEMP_CONF += --temp-config=S(TEMP_CONFIG)
26+
endif
27+
2228
# where to find psql for testing an existing installation
2329
PSQLDIR = $(bindir)
2430

@@ -135,7 +141,7 @@ tablespace-setup:
135141
##
136142

137143
check: all
138-
./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)
144+
./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)
139145

140146
installcheck: all
141147
./pg_regress --psqldir=$(PSQLDIR) --schedule=$(srcdir)/serial_schedule --srcdir=$(abs_srcdir) --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE)

src/test/regress/pg_regress.c

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
1212
* Portions Copyright (c) 1994, Regents of the University of California
1313
*
14-
* $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.36 2007/07/18 21:19:17 alvherre Exp $
14+
* $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.37 2007/09/09 20:40:54 adunstan Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -76,6 +76,7 @@ static char *encoding = NULL;
7676
static _stringlist *schedulelist = NULL;
7777
static _stringlist *extra_tests = NULL;
7878
static char *temp_install = NULL;
79+
static char *temp_config = NULL;
7980
static char *top_builddir = NULL;
8081
static int temp_port = 65432;
8182
static bool nolocale = false;
@@ -1718,11 +1719,12 @@ help(void)
17181719
printf(_(" (can be used multiple times to concatenate)\n"));
17191720
printf(_(" --srcdir=DIR absolute path to source directory (for VPATH builds)\n"));
17201721
printf(_(" --temp-install=DIR create a temporary installation in DIR\n"));
1721-
printf(_(" --no-locale use C locale\n"));
17221722
printf(_("\n"));
17231723
printf(_("Options for \"temp-install\" mode:\n"));
1724+
printf(_(" --no-locale use C locale\n"));
17241725
printf(_(" --top-builddir=DIR (relative) path to top level build directory\n"));
17251726
printf(_(" --temp-port=PORT port number to start temp postmaster on\n"));
1727+
printf(_(" --temp-config=PATH append contents of PATH to temporary config\n"));
17261728
printf(_("\n"));
17271729
printf(_("Options for using an existing installation:\n"));
17281730
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
17661768
{"psqldir", required_argument, NULL, 16},
17671769
{"srcdir", required_argument, NULL, 17},
17681770
{"create-role", required_argument, NULL, 18},
1771+
{"temp-config", required_argument, NULL, 19},
17691772
{NULL, 0, NULL, 0}
17701773
};
17711774

@@ -1874,6 +1877,9 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
18741877
case 18:
18751878
split_to_stringlist(strdup(optarg), ", ", &extraroles);
18761879
break;
1880+
case 19:
1881+
temp_config = strdup(optarg);
1882+
break;
18771883
default:
18781884
/* getopt_long already emitted a complaint */
18791885
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
19621968
exit_nicely(2);
19631969
}
19641970

1971+
/* add any extra config specified to the postgresql.conf */
1972+
if (temp_config != NULL)
1973+
{
1974+
FILE * extra_conf;
1975+
FILE * pg_conf;
1976+
char line_buf[1024];
1977+
1978+
snprintf(buf, sizeof(buf),"%s/data/postgresql.conf", temp_install);
1979+
pg_conf = fopen(buf,"a");
1980+
if (pg_conf == NULL)
1981+
{
1982+
fprintf(stderr, _("\n%s: could not open %s for adding extra config:\nError was %s\n"), progname, buf, strerror(errno));
1983+
exit_nicely(2);
1984+
}
1985+
extra_conf = fopen(temp_config,"r");
1986+
if (extra_conf == NULL)
1987+
{
1988+
fprintf(stderr, _("\n%s: could not open %s to read extra config:\nError was %s\n"), progname, buf, strerror(errno));
1989+
exit_nicely(2);
1990+
}
1991+
while(fgets(line_buf, sizeof(line_buf),extra_conf) != NULL)
1992+
fputs(line_buf, pg_conf);
1993+
fclose(extra_conf);
1994+
fclose(pg_conf);
1995+
}
1996+
19651997
/*
19661998
* Start the temp postmaster
19671999
*/

0 commit comments

Comments
 (0)