Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbc660c4

Browse files
committed
Ah, I finally realize why Magnus wanted to add a --bindir option to
pg_regress: there's no other way to cope with testing a relocatedinstallation. Seems better to call it --psqldir though, since theonly thing we need to find in that case is psql. It'd be better ifwe could use find_other_exec, but that's not happening unless we arewilling to install pg_regress alongside psql, which seems unlikelyto happen.
1 parent9652b79 commitbc660c4

File tree

6 files changed

+55
-24
lines changed

6 files changed

+55
-24
lines changed

‎src/makefiles/pgxs.mk

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# PGXS: PostgreSQL extensions makefile
22

3-
# $PostgreSQL: pgsql/src/makefiles/pgxs.mk,v 1.8 2006/07/19 02:37:00 tgl Exp $
3+
# $PostgreSQL: pgsql/src/makefiles/pgxs.mk,v 1.9 2006/07/21 00:24:04 tgl Exp $
44

55
# This file contains generic rules to build many kinds of simple
66
# extension modules. You only need to set a few variables and include
@@ -210,6 +210,9 @@ ifndef REGRESS_OPTS
210210
REGRESS_OPTS = --dbname=$(CONTRIB_TESTDB)
211211
endif
212212

213+
# where to find psql for running the tests
214+
PSQLDIR =$(bindir)
215+
213216
# When doing a VPATH build, must copy over the test .sql and .out
214217
# files so that the driver script can find them. We have to use an
215218
# absolute path for the targets, because otherwise make will try to
@@ -235,7 +238,7 @@ endif
235238

236239
# against installed postmaster
237240
installcheck: submake
238-
$(top_builddir)/src/test/regress/pg_regress$(REGRESS_OPTS)$(REGRESS)
241+
$(top_builddir)/src/test/regress/pg_regress--psqldir=$(PSQLDIR)$(REGRESS_OPTS)$(REGRESS)
239242

240243
# in-tree test doesn't work yet (no way to install my shared library)
241244
#check: all submake

‎src/pl/plperl/GNUmakefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Makefile for PL/Perl
2-
# $PostgreSQL: pgsql/src/pl/plperl/GNUmakefile,v 1.27 2006/07/19 02:37:00 tgl Exp $
2+
# $PostgreSQL: pgsql/src/pl/plperl/GNUmakefile,v 1.28 2006/07/21 00:24:04 tgl Exp $
33

44
subdir = src/pl/plperl
55
top_builddir = ../../..
@@ -38,6 +38,8 @@ SHLIB_LINK = $(perl_embed_ldflags) $(BE_DLLLIBS)
3838

3939
REGRESS_OPTS = --dbname=$(PL_TESTDB) --load-language=plperl
4040
REGRESS = plperl plperl_trigger plperl_shared plperl_elog
41+
# where to find psql for running the tests
42+
PSQLDIR =$(bindir)
4143

4244
include$(top_srcdir)/src/Makefile.shlib
4345

@@ -84,7 +86,7 @@ uninstall:
8486
rm -f'$(DESTDIR)$(pkglibdir)/plperl$(DLSUFFIX)'
8587

8688
installcheck: submake
87-
$(top_builddir)/src/test/regress/pg_regress$(REGRESS_OPTS)$(REGRESS)
89+
$(top_builddir)/src/test/regress/pg_regress--psqldir=$(PSQLDIR)$(REGRESS_OPTS)$(REGRESS)
8890

8991
.PHONY: submake
9092
submake:

‎src/pl/plpython/Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $PostgreSQL: pgsql/src/pl/plpython/Makefile,v 1.25 2006/07/19 02:37:00 tgl Exp $
1+
# $PostgreSQL: pgsql/src/pl/plpython/Makefile,v 1.26 2006/07/21 00:24:04 tgl Exp $
22

33
subdir = src/pl/plpython
44
top_builddir = ../../..
@@ -60,6 +60,8 @@ SHLIB_LINK = $(BE_DLLLIBS) $(python_libspec) $(python_additional_libs)
6060

6161
REGRESS_OPTS = --dbname=$(PL_TESTDB) --load-language=plpythonu
6262
REGRESS = plpython_schema plpython_populate plpython_function plpython_test plpython_error plpython_drop
63+
# where to find psql for running the tests
64+
PSQLDIR =$(bindir)
6365

6466
include$(top_srcdir)/src/Makefile.shlib
6567

@@ -103,7 +105,7 @@ uninstall:
103105
rm -f'$(DESTDIR)$(pkglibdir)/plpython$(DLSUFFIX)'
104106

105107
installcheck: submake
106-
$(top_builddir)/src/test/regress/pg_regress$(REGRESS_OPTS)$(REGRESS)
108+
$(top_builddir)/src/test/regress/pg_regress--psqldir=$(PSQLDIR)$(REGRESS_OPTS)$(REGRESS)
107109

108110
.PHONY: submake
109111
submake:

‎src/pl/tcl/Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Makefile for the pltcl shared object
44
#
5-
# $PostgreSQL: pgsql/src/pl/tcl/Makefile,v 1.49 2006/07/19 02:37:00 tgl Exp $
5+
# $PostgreSQL: pgsql/src/pl/tcl/Makefile,v 1.50 2006/07/21 00:24:04 tgl Exp $
66
#
77
#-------------------------------------------------------------------------
88

@@ -42,6 +42,8 @@ OBJS = pltcl.o
4242

4343
REGRESS_OPTS = --dbname=$(PL_TESTDB) --load-language=pltcl
4444
REGRESS = pltcl_setup pltcl_queries
45+
# where to find psql for running the tests
46+
PSQLDIR =$(bindir)
4547

4648
include$(top_srcdir)/src/Makefile.shlib
4749

@@ -90,7 +92,7 @@ uninstall:
9092
$(MAKE) -C modules$@
9193

9294
installcheck: submake
93-
$(top_builddir)/src/test/regress/pg_regress$(REGRESS_OPTS)$(REGRESS)
95+
$(top_builddir)/src/test/regress/pg_regress--psqldir=$(PSQLDIR)$(REGRESS_OPTS)$(REGRESS)
9496

9597
.PHONY: submake
9698
submake:

‎src/test/regress/GNUmakefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Portions Copyright (c) 1996-2006, 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.61 2006/07/20 01:16:57 tgl Exp $
9+
# $PostgreSQL: pgsql/src/test/regress/GNUmakefile,v 1.62 2006/07/21 00:24:04 tgl Exp $
1010
#
1111
#-------------------------------------------------------------------------
1212

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

22+
# where to find psql for testing an existing installation
23+
PSQLDIR =$(bindir)
24+
2225
# default encoding
2326
MULTIBYTE = SQL_ASCII
2427

@@ -150,12 +153,12 @@ check: all
150153
installcheck: all
151154
-rm -rf ./testtablespace
152155
mkdir ./testtablespace
153-
./pg_regress --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql$(NOLOCALE)
156+
./pg_regress --psqldir=$(PSQLDIR) --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql$(NOLOCALE)
154157

155158
installcheck-parallel: all
156159
-rm -rf ./testtablespace
157160
mkdir ./testtablespace
158-
./pg_regress --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql$(MAXCONNOPT)$(NOLOCALE)
161+
./pg_regress --psqldir=$(PSQLDIR) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql$(MAXCONNOPT)$(NOLOCALE)
159162

160163

161164
# old interfaces follow...
@@ -165,7 +168,7 @@ runtest: installcheck
165168
runtest-parallel: installcheck-parallel
166169

167170
bigtest:
168-
./pg_regress --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql$(NOLOCALE) numeric_big
171+
./pg_regress --psqldir=$(PSQLDIR) --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql$(NOLOCALE) numeric_big
169172

170173
bigcheck:
171174
./pg_regress --temp-install=./tmp_check --top-builddir=$(top_builddir) --temp-port=$(TEMP_PORT) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql$(MAXCONNOPT)$(NOLOCALE) numeric_big

‎src/test/regress/pg_regress.c

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
* pg_regress --- regression test driver
44
*
55
* This is a C implementation of the previous shell script for running
6-
* the regression tests, and should behighly compatible with it.
6+
* the regression tests, and should bemostly compatible with it.
77
* Initial author of C translation: Magnus Hagander
88
*
99
* This code is released under the terms of the PostgreSQL License.
1010
*
1111
* Portions Copyright (c) 1996-2006, 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.10 2006/07/20 16:25:30 tgl Exp $
14+
* $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.11 2006/07/21 00:24:04 tgl Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -52,11 +52,11 @@ typedef struct _resultmap
5252
}_resultmap;
5353

5454
/*
55-
* Values obtained from pg_config_paths.h and Makefile.(It might seem
56-
*tempting to get the paths via get_share_path() and friends, but that's
57-
*not going to work because pg_regress is typically not executed from an
58-
*installed bin directory. In any case, for our purposestheconfigured
59-
*paths are what we want anyway.)
55+
* Values obtained from pg_config_paths.h and Makefile.The PG installation
56+
*paths are only used in temp_install mode: we use these strings to find
57+
*out where "make install" will put stuff under the temp_install directory.
58+
*In non-temp_install mode, the only thing we need isthelocation of psql,
59+
*which we expect to find in psqldir, or in the PATH if psqldir isn't given.
6060
*/
6161
staticchar*bindir=PGBINDIR;
6262
staticchar*libdir=LIBDIR;
@@ -85,6 +85,7 @@ static char *temp_install = NULL;
8585
staticchar*top_builddir=NULL;
8686
staticinttemp_port=65432;
8787
staticboolnolocale= false;
88+
staticchar*psqldir=NULL;
8889
staticchar*hostname=NULL;
8990
staticintport=-1;
9091
staticchar*user=NULL;
@@ -499,6 +500,9 @@ initialize_environment(void)
499500
sprintf(tmp,"%s/install/%s",temp_install,datadir);
500501
datadir=tmp;
501502

503+
/* psql will be installed into temp-install bindir */
504+
psqldir=bindir;
505+
502506
/*
503507
* Set up shared library paths to include the temp install.
504508
*
@@ -539,7 +543,8 @@ initialize_environment(void)
539543

540544
/*
541545
* On Windows, it seems to be necessary to adjust PATH even in
542-
* this case.
546+
* this case. (XXX really? If so, what if installation has
547+
* been relocated?)
543548
*/
544549
#ifdefWIN32
545550
add_to_path("PATH",';',libdir);
@@ -600,8 +605,11 @@ psql_command(const char *database, const char *query, ...)
600605

601606
/* And now we can build and execute the shell command */
602607
snprintf(psql_cmd,sizeof(psql_cmd),
603-
SYSTEMQUOTE"\"%s/psql\" -X -c \"%s\" \"%s\""SYSTEMQUOTE,
604-
bindir,query_escaped,database);
608+
SYSTEMQUOTE"\"%s%spsql\" -X -c \"%s\" \"%s\""SYSTEMQUOTE,
609+
psqldir ?psqldir :"",
610+
psqldir ?"/" :"",
611+
query_escaped,
612+
database);
605613

606614
if (system(psql_cmd)!=0)
607615
{
@@ -699,8 +707,12 @@ psql_start_test(const char *testname)
699707
outputdir,testname);
700708

701709
snprintf(psql_cmd,sizeof(psql_cmd),
702-
SYSTEMQUOTE"\"%s/psql\" -X -a -q -d \"%s\" < \"%s\" > \"%s\" 2>&1"SYSTEMQUOTE,
703-
bindir,dbname,infile,outfile);
710+
SYSTEMQUOTE"\"%s%spsql\" -X -a -q -d \"%s\" < \"%s\" > \"%s\" 2>&1"SYSTEMQUOTE,
711+
psqldir ?psqldir :"",
712+
psqldir ?"/" :"",
713+
dbname,
714+
infile,
715+
outfile);
704716

705717
pid=spawn_process(psql_cmd);
706718

@@ -1267,6 +1279,7 @@ help(void)
12671279
printf(_(" --host=HOST use postmaster running on HOST\n"));
12681280
printf(_(" --port=PORT use postmaster running at PORT\n"));
12691281
printf(_(" --user=USER connect as USER\n"));
1282+
printf(_(" --psqldir=DIR use psql in DIR (default: find in PATH)\n"));
12701283
printf(_("\n"));
12711284
printf(_("The exit status is 0 if all tests passed, 1 if some tests failed, and 2\n"));
12721285
printf(_("if the tests could not be run for some reason.\n"));
@@ -1301,6 +1314,7 @@ main(int argc, char *argv[])
13011314
{"host",required_argument,NULL,13},
13021315
{"port",required_argument,NULL,14},
13031316
{"user",required_argument,NULL,15},
1317+
{"psqldir",required_argument,NULL,16},
13041318
{NULL,0,NULL,0}
13051319
};
13061320

@@ -1388,6 +1402,11 @@ main(int argc, char *argv[])
13881402
case15:
13891403
user=strdup(optarg);
13901404
break;
1405+
case16:
1406+
/* "--psqldir=" should mean to use PATH */
1407+
if (strlen(optarg))
1408+
psqldir=strdup(optarg);
1409+
break;
13911410
default:
13921411
/* getopt_long already emitted a complaint */
13931412
fprintf(stderr,_("\nTry \"%s -h\" for more information.\n"),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp