|
11 | 11 | * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
|
12 | 12 | * Portions Copyright (c) 1994, Regents of the University of California
|
13 | 13 | *
|
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 $ |
15 | 15 | *
|
16 | 16 | *-------------------------------------------------------------------------
|
17 | 17 | */
|
@@ -76,6 +76,7 @@ static char *encoding = NULL;
|
76 | 76 | static_stringlist*schedulelist=NULL;
|
77 | 77 | static_stringlist*extra_tests=NULL;
|
78 | 78 | staticchar*temp_install=NULL;
|
| 79 | +staticchar*temp_config=NULL; |
79 | 80 | staticchar*top_builddir=NULL;
|
80 | 81 | staticinttemp_port=65432;
|
81 | 82 | staticboolnolocale= false;
|
@@ -1718,11 +1719,12 @@ help(void)
|
1718 | 1719 | printf(_(" (can be used multiple times to concatenate)\n"));
|
1719 | 1720 | printf(_(" --srcdir=DIR absolute path to source directory (for VPATH builds)\n"));
|
1720 | 1721 | printf(_(" --temp-install=DIR create a temporary installation in DIR\n"));
|
1721 |
| -printf(_(" --no-locale use C locale\n")); |
1722 | 1722 | printf(_("\n"));
|
1723 | 1723 | printf(_("Options for \"temp-install\" mode:\n"));
|
| 1724 | +printf(_(" --no-locale use C locale\n")); |
1724 | 1725 | printf(_(" --top-builddir=DIR (relative) path to top level build directory\n"));
|
1725 | 1726 | 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")); |
1726 | 1728 | printf(_("\n"));
|
1727 | 1729 | printf(_("Options for using an existing installation:\n"));
|
1728 | 1730 | 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
|
1766 | 1768 | {"psqldir",required_argument,NULL,16},
|
1767 | 1769 | {"srcdir",required_argument,NULL,17},
|
1768 | 1770 | {"create-role",required_argument,NULL,18},
|
| 1771 | +{"temp-config",required_argument,NULL,19}, |
1769 | 1772 | {NULL,0,NULL,0}
|
1770 | 1773 | };
|
1771 | 1774 |
|
@@ -1874,6 +1877,9 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
|
1874 | 1877 | case18:
|
1875 | 1878 | split_to_stringlist(strdup(optarg),", ",&extraroles);
|
1876 | 1879 | break;
|
| 1880 | +case19: |
| 1881 | +temp_config=strdup(optarg); |
| 1882 | +break; |
1877 | 1883 | default:
|
1878 | 1884 | /* getopt_long already emitted a complaint */
|
1879 | 1885 | 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
|
1962 | 1968 | exit_nicely(2);
|
1963 | 1969 | }
|
1964 | 1970 |
|
| 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 | +charline_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 | + |
1965 | 1997 | /*
|
1966 | 1998 | * Start the temp postmaster
|
1967 | 1999 | */
|
|