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

Commit a38c85b

Browse files
committed
Rewrite pg_regress as a C program instead of a shell script.
This allows it to be used on Windows without installing mingw (though you do still need 'diff'), and opens the door to future improvements such as message localization. Magnus Hagander and Tom Lane.
1 parent 8829524 commit a38c85b

File tree

10 files changed

+1645
-852
lines changed

10 files changed

+1645
-852
lines changed

doc/FAQ_HPUX

+1-17
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Frequently Asked Questions (FAQ) for PostgreSQL 7.3
33
HP-UX Specific
44
TO BE READ IN CONJUNCTION WITH THE NORMAL FAQ
55
=======================================================
6-
last updated: $Date: 2004/09/02 17:46:24 $
6+
last updated: $Date: 2006/07/19 02:37:00 $
77

88
current maintainer: Tom Lane (tgl@sss.pgh.pa.us)
99
original author: Tom Lane (tgl@sss.pgh.pa.us)
@@ -84,19 +84,3 @@ low-order-digit differences in the geometry tests, which vary depending
8484
on which compiler and math library versions you use.
8585

8686
Any other error is cause for suspicion.
87-
88-
The parallel regression test script (gmake check) is known to lock up
89-
on PA-RISC when run under HP's Bourne shells: /usr/bin/sh and
90-
/sbin/sh. To fix this problem, you will need PHCO_30269 with its
91-
dependent patch or successor patches:
92-
93-
PHCO_30269 s700_800 cumulative sh-posix(1) patch
94-
PHCO_29816 s700_800 rc(1M) scripts cumulative patch
95-
96-
To work around this problem, use ksh to run the regression script:
97-
98-
gmake SHELL=/bin/ksh check
99-
100-
If you see that the tests have stopped making progress and only a shell
101-
process is consuming CPU, kill the shell process and start over with the
102-
above command.

doc/src/sgml/regress.sgml

+5-21
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/regress.sgml,v 1.52 2006/06/18 15:38:36 petere Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/regress.sgml,v 1.53 2006/07/19 02:37:00 tgl Exp $ -->
22

33
<chapter id="regress">
44
<title id="regress-title">Regression Tests</title>
@@ -110,19 +110,6 @@ gmake MAX_CONNECTIONS=10 check
110110
runs no more than ten tests concurrently.
111111
</para>
112112

113-
<para>
114-
On some systems, the default Bourne-compatible shell
115-
(<filename>/bin/sh</filename>) gets confused when it has to manage
116-
too many child processes in parallel. This may cause the parallel
117-
test run to lock up or fail. In such cases, specify a different
118-
Bourne-compatible shell on the command line, for example:
119-
<screen>
120-
gmake SHELL=/bin/ksh check
121-
</screen>
122-
If no non-broken shell is available, you may be able to work around the
123-
problem by limiting the number of connections, as shown above.
124-
</para>
125-
126113
<para>
127114
To run the tests after installation<![%standalone-ignore;[ (see <xref linkend="installation">)]]>,
128115
initialize a data area and start the
@@ -370,13 +357,10 @@ testname/platformpattern=comparisonfilename
370357
The test name is just the name of the particular regression test
371358
module. The platform pattern is a pattern in the style of the Unix
372359
tool <command>expr</> (that is, a regular expression with an implicit
373-
<literal>^</literal> anchor
374-
at the start). It is matched against the platform name as printed
375-
by <command>config.guess</command> followed by
376-
<literal>:gcc</literal> or <literal>:cc</literal>, depending on
377-
whether you use the GNU compiler or the system's native compiler
378-
(on systems where there is a difference). The comparison file
379-
name is the base name of the substitute result comparison file.
360+
<literal>^</literal> anchor at the start). It is matched against the
361+
platform name as printed by <command>config.guess</command>.
362+
The comparison file name is the base name of the substitute result
363+
comparison file.
380364
</para>
381365

382366
<para>

src/makefiles/pgxs.mk

+4-4
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.7 2005/12/09 21:19:36 petere Exp $
3+
# $PostgreSQL: pgsql/src/makefiles/pgxs.mk,v 1.8 2006/07/19 02:37:00 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
@@ -230,16 +230,16 @@ endif # VPATH
230230
.PHONY: submake
231231
submake:
232232
ifndef PGXS
233-
$(MAKE) -C $(top_builddir)/src/test/regress pg_regress
233+
$(MAKE) -C $(top_builddir)/src/test/regress pg_regress$(X)
234234
endif
235235

236236
# against installed postmaster
237237
installcheck: submake
238-
$(SHELL) $(top_builddir)/src/test/regress/pg_regress $(REGRESS_OPTS) $(REGRESS)
238+
$(top_builddir)/src/test/regress/pg_regress $(REGRESS_OPTS) $(REGRESS)
239239

240240
# in-tree test doesn't work yet (no way to install my shared library)
241241
#check: all submake
242-
# $(SHELL) $(top_builddir)/src/test/regress/pg_regress --temp-install \
242+
# $(top_builddir)/src/test/regress/pg_regress --temp-install \
243243
# --top-builddir=$(top_builddir) $(REGRESS_OPTS) $(REGRESS)
244244
check:
245245
@echo "'make check' is not supported."

src/pl/plperl/GNUmakefile

+3-3
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.26 2005/12/09 21:19:36 petere Exp $
2+
# $PostgreSQL: pgsql/src/pl/plperl/GNUmakefile,v 1.27 2006/07/19 02:37:00 tgl Exp $
33

44
subdir = src/pl/plperl
55
top_builddir = ../../..
@@ -84,11 +84,11 @@ uninstall:
8484
rm -f '$(DESTDIR)$(pkglibdir)/plperl$(DLSUFFIX)'
8585

8686
installcheck: submake
87-
$(SHELL) $(top_builddir)/src/test/regress/pg_regress $(REGRESS_OPTS) $(REGRESS)
87+
$(top_builddir)/src/test/regress/pg_regress $(REGRESS_OPTS) $(REGRESS)
8888

8989
.PHONY: submake
9090
submake:
91-
$(MAKE) -C $(top_builddir)/src/test/regress pg_regress
91+
$(MAKE) -C $(top_builddir)/src/test/regress pg_regress$(X)
9292

9393
clean distclean maintainer-clean: clean-lib
9494
rm -f SPI.c $(OBJS)

src/pl/plpython/Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $PostgreSQL: pgsql/src/pl/plpython/Makefile,v 1.24 2005/12/09 21:19:36 petere Exp $
1+
# $PostgreSQL: pgsql/src/pl/plpython/Makefile,v 1.25 2006/07/19 02:37:00 tgl Exp $
22

33
subdir = src/pl/plpython
44
top_builddir = ../../..
@@ -103,11 +103,11 @@ uninstall:
103103
rm -f '$(DESTDIR)$(pkglibdir)/plpython$(DLSUFFIX)'
104104

105105
installcheck: submake
106-
$(SHELL) $(top_builddir)/src/test/regress/pg_regress $(REGRESS_OPTS) $(REGRESS)
106+
$(top_builddir)/src/test/regress/pg_regress $(REGRESS_OPTS) $(REGRESS)
107107

108108
.PHONY: submake
109109
submake:
110-
$(MAKE) -C $(top_builddir)/src/test/regress pg_regress
110+
$(MAKE) -C $(top_builddir)/src/test/regress pg_regress$(X)
111111

112112
clean distclean maintainer-clean: clean-lib
113113
rm -f $(OBJS)

src/pl/tcl/Makefile

+3-3
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.48 2005/12/09 21:19:36 petere Exp $
5+
# $PostgreSQL: pgsql/src/pl/tcl/Makefile,v 1.49 2006/07/19 02:37:00 tgl Exp $
66
#
77
#-------------------------------------------------------------------------
88

@@ -90,11 +90,11 @@ uninstall:
9090
$(MAKE) -C modules $@
9191

9292
installcheck: submake
93-
$(SHELL) $(top_builddir)/src/test/regress/pg_regress $(REGRESS_OPTS) $(REGRESS)
93+
$(top_builddir)/src/test/regress/pg_regress $(REGRESS_OPTS) $(REGRESS)
9494

9595
.PHONY: submake
9696
submake:
97-
$(MAKE) -C $(top_builddir)/src/test/regress pg_regress
97+
$(MAKE) -C $(top_builddir)/src/test/regress pg_regress$(X)
9898

9999
else # TCL_SHARED_BUILD = 0
100100

src/test/regress/GNUmakefile

+24-23
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.57 2006/03/05 15:59:11 momjian Exp $
9+
# $PostgreSQL: pgsql/src/test/regress/GNUmakefile,v 1.58 2006/07/19 02:37:00 tgl Exp $
1010
#
1111
#-------------------------------------------------------------------------
1212

@@ -34,32 +34,33 @@ ifdef NO_LOCALE
3434
NOLOCALE += --no-locale
3535
endif
3636

37+
# stuff to pass into build of pg_regress
38+
EXTRADEFS = '-DPGBINDIR="$(bindir)"' \
39+
'-DLIBDIR="$(libdir)"' \
40+
'-DPGSHAREDIR="$(datadir)"' \
41+
'-DHOST_TUPLE="$(host_tuple)"' \
42+
'-DMAKEPROG="$(MAKE)"'
43+
3744
##
3845
## Prepare for tests
3946
##
4047

4148
# Build regression test driver
4249

43-
all: pg_regress
50+
all: submake-libpgport pg_regress$(X)
51+
52+
pg_regress$(X): pg_regress.o
53+
$(CC) $(CFLAGS) $^ $(libpq_pgport) $(LDFLAGS) $(LIBS) -o $@
4454

45-
pg_regress: pg_regress.sh GNUmakefile $(top_builddir)/src/Makefile.global
46-
sed -e 's,@bindir@,$(bindir),g' \
47-
-e 's,@libdir@,$(libdir),g' \
48-
-e 's,@pkglibdir@,$(pkglibdir),g' \
49-
-e 's,@datadir@,$(datadir),g' \
50-
-e 's/@VERSION@/$(VERSION)/g' \
51-
-e 's/@host_tuple@/$(host_tuple)/g' \
52-
-e 's,@GMAKE@,$(MAKE),g' \
53-
-e 's/@enable_shared@/$(enable_shared)/g' \
54-
-e 's/@GCC@/$(GCC)/g' \
55-
$< >$@
56-
chmod a+x $@
55+
# depend on Makefile.global to ensure that symbol changes propagate
56+
pg_regress.o: pg_regress.c $(top_builddir)/src/Makefile.global
57+
$(CC) $(CFLAGS) $(CPPFLAGS) $(EXTRADEFS) -c -o $@ $<
5758

58-
install: pg_regress
59-
$(INSTALL_SCRIPT) pg_regress '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress'
59+
install: pg_regress$(X)
60+
$(INSTALL_PROGRAM) pg_regress$(X) '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
6061

6162
uninstall:
62-
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress'
63+
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
6364

6465

6566
# Build dynamically-loaded object file for CREATE FUNCTION ... LANGUAGE C.
@@ -143,17 +144,17 @@ all-spi:
143144
check: all
144145
-rm -rf ./testtablespace
145146
mkdir ./testtablespace
146-
$(SHELL) ./pg_regress --temp-install --top-builddir=$(top_builddir) --temp-port=$(TEMP_PORT) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE)
147+
./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)
147148

148149
installcheck: all
149150
-rm -rf ./testtablespace
150151
mkdir ./testtablespace
151-
$(SHELL) ./pg_regress --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE)
152+
./pg_regress --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE)
152153

153154
installcheck-parallel: all
154155
-rm -rf ./testtablespace
155156
mkdir ./testtablespace
156-
$(SHELL) ./pg_regress --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE)
157+
./pg_regress --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE)
157158

158159

159160
# old interfaces follow...
@@ -163,10 +164,10 @@ runtest: installcheck
163164
runtest-parallel: installcheck-parallel
164165

165166
bigtest:
166-
$(SHELL) ./pg_regress --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE) numeric_big
167+
./pg_regress --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE) numeric_big
167168

168169
bigcheck:
169-
$(SHELL) ./pg_regress --temp-install --top-builddir=$(top_builddir) --temp-port=$(TEMP_PORT) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE) numeric_big
170+
./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
170171

171172

172173
##
@@ -177,7 +178,7 @@ clean distclean maintainer-clean: clean-lib
177178
# things built by `all' target
178179
rm -f $(NAME)$(DLSUFFIX) $(OBJS)
179180
$(MAKE) -C $(contribdir)/spi clean
180-
rm -f $(output_files) $(input_files) pg_regress
181+
rm -f $(output_files) $(input_files) pg_regress.o pg_regress$(X)
181182
# things created by various check targets
182183
rm -rf testtablespace
183184
rm -rf results tmp_check log

src/test/regress/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
# GNU make uses a make file named "GNUmakefile" in preference to "Makefile"
88
# if it exists. Postgres is shipped with a "GNUmakefile".
99

10-
all install clean dep depend:
10+
all install clean dep depend check installcheck:
1111
@echo "You must use GNU make to use Postgres. It may be installed"
1212
@echo "on your system with the name 'gmake'."

0 commit comments

Comments
 (0)