Skip to content

Commit dcae5fa

Browse files
committed
Improve speed of make check-world
Before, make check-world would create a new temporary installation for each test suite, which is slow and wasteful. Instead, we now create one test installation that is used by all test suites that are part of a make run. The management of the temporary installation is removed from pg_regress and handled in the makefiles. This allows for better control, and unifies the code with that of test suites not run through pg_regress. review and msvc support by Michael Paquier <michael.paquier@gmail.com> more review by Fabien Coelho <coelho@cri.ensmp.fr>
1 parent 50a16e3 commit dcae5fa

File tree

17 files changed

+145
-261
lines changed

17 files changed

+145
-261
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ lib*.pc
3636
/pgsql.sln.cache
3737
/Debug/
3838
/Release/
39+
/tmp_install/

GNUmakefile.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ $(call recurse,distprep,doc src config contrib)
4747
# it's not built by default
4848
$(call recurse,clean,doc contrib src config)
4949
clean:
50+
rm -rf tmp_install/
5051
# Garbage from autoconf:
5152
@rm -rf autom4te.cache/
5253

contrib/earthdistance/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ DATA = earthdistance--1.0.sql earthdistance--unpackaged--1.0.sql
77
PGFILEDESC = "earthdistance - calculate distances on the surface of the Earth"
88

99
REGRESS = earthdistance
10-
REGRESS_OPTS = --extra-install=contrib/cube
10+
EXTRA_INSTALL = contrib/cube
1111

1212
LDFLAGS_SL += $(filter -lm, $(LIBS))
1313

contrib/test_decoding/Makefile

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,35 +39,33 @@ submake-test_decoding:
3939

4040
REGRESSCHECKS=ddl rewrite toast permissions decoding_in_xact decoding_into_rel binary prepared
4141

42-
regresscheck: all | submake-regress submake-test_decoding
42+
regresscheck: all | submake-regress submake-test_decoding temp-install
4343
$(MKDIR_P) regression_output
4444
$(pg_regress_check) \
4545
--temp-config $(top_srcdir)/contrib/test_decoding/logical.conf \
46-
--temp-install=./tmp_check \
47-
--extra-install=contrib/test_decoding \
46+
--temp-instance=./tmp_check \
4847
--outputdir=./regression_output \
4948
$(REGRESSCHECKS)
5049

51-
regresscheck-install-force: | submake-regress submake-test_decoding
50+
regresscheck-install-force: | submake-regress submake-test_decoding temp-install
5251
$(pg_regress_installcheck) \
53-
--extra-install=contrib/test_decoding \
5452
$(REGRESSCHECKS)
5553

5654
ISOLATIONCHECKS=mxact delayed_startup ondisk_startup concurrent_ddl_dml
5755

58-
isolationcheck: all | submake-isolation submake-test_decoding
56+
isolationcheck: all | submake-isolation submake-test_decoding temp-install
5957
$(MKDIR_P) isolation_output
6058
$(pg_isolation_regress_check) \
6159
--temp-config $(top_srcdir)/contrib/test_decoding/logical.conf \
62-
--extra-install=contrib/test_decoding \
6360
--outputdir=./isolation_output \
6461
$(ISOLATIONCHECKS)
6562

66-
isolationcheck-install-force: all | submake-isolation submake-test_decoding
63+
isolationcheck-install-force: all | submake-isolation submake-test_decoding temp-install
6764
$(pg_isolation_regress_installcheck) \
68-
--extra-install=contrib/test_decoding \
6965
$(ISOLATIONCHECKS)
7066

7167
PHONY: submake-test_decoding submake-regress check \
7268
regresscheck regresscheck-install-force \
7369
isolationcheck isolationcheck-install-force
70+
71+
temp-install: EXTRA_INSTALL=contrib/test_decoding

src/Makefile.global.in

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ MAJORVERSION = @PG_MAJORVERSION@
4343
# (PGXS VPATH support is handled separately in pgxs.mk)
4444
ifndef PGXS
4545
vpath_build = @vpath_build@
46+
abs_top_builddir = @abs_top_builddir@
4647
abs_top_srcdir = @abs_top_srcdir@
4748

4849
ifneq ($(vpath_build),yes)
@@ -301,6 +302,17 @@ BZIP2 = bzip2
301302

302303
# Testing
303304

305+
check: temp-install
306+
307+
.PHONY: temp-install
308+
temp-install:
309+
ifeq ($(MAKELEVEL),0)
310+
rm -rf '$(abs_top_builddir)'/tmp_install
311+
$(MKDIR_P) '$(abs_top_builddir)'/tmp_install/log
312+
$(MAKE) -C '$(top_builddir)' DESTDIR='$(abs_top_builddir)'/tmp_install install >'$(abs_top_builddir)'/tmp_install/log/install.log 2>&1
313+
endif
314+
for extra in $(EXTRA_INSTALL); do $(MAKE) -C '$(top_builddir)'/$$extra DESTDIR='$(abs_top_builddir)'/tmp_install install >>'$(abs_top_builddir)'/tmp_install/log/install.log 2>&1 || exit; done
315+
304316
PROVE = @PROVE@
305317
PG_PROVE_FLAGS = -I $(top_srcdir)/src/test/perl/
306318
PROVE_FLAGS = --verbose
@@ -315,16 +327,18 @@ define ld_library_path_var
315327
$(if $(filter $(PORTNAME),darwin),DYLD_LIBRARY_PATH,$(if $(filter $(PORTNAME),aix),LIBPATH,LD_LIBRARY_PATH))
316328
endef
317329

330+
define with_temp_install
331+
PATH="$(abs_top_builddir)/tmp_install$(bindir):$$PATH" $(call add_to_path,$(ld_library_path_var),$(abs_top_builddir)/tmp_install$(libdir))
332+
endef
333+
318334
ifeq ($(enable_tap_tests),yes)
319335

320336
define prove_installcheck
321337
cd $(srcdir) && TESTDIR='$(CURDIR)' PATH="$(bindir):$$PATH" PGPORT='6$(DEF_PGPORT)' top_builddir='$(CURDIR)/$(top_builddir)' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) t/*.pl
322338
endef
323339

324340
define prove_check
325-
$(MKDIR_P) tmp_check/log
326-
$(MAKE) -C $(top_builddir) DESTDIR='$(CURDIR)'/tmp_check/install install >'$(CURDIR)'/tmp_check/log/install.log 2>&1
327-
cd $(srcdir) && TESTDIR='$(CURDIR)' PATH="$(CURDIR)/tmp_check/install$(bindir):$$PATH" $(call add_to_path,$(ld_library_path_var),$(CURDIR)/tmp_check/install$(libdir)) top_builddir='$(CURDIR)/$(top_builddir)' PGPORT='6$(DEF_PGPORT)' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) t/*.pl
341+
cd $(srcdir) && TESTDIR='$(CURDIR)' $(with_temp_install) PGPORT='6$(DEF_PGPORT)' top_builddir='$(CURDIR)/$(top_builddir)' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) t/*.pl
328342
endef
329343

330344
else
@@ -495,13 +509,13 @@ endif
495509

496510
pg_regress_locale_flags = $(if $(ENCODING),--encoding=$(ENCODING)) $(NOLOCALE)
497511

498-
pg_regress_check = $(top_builddir)/src/test/regress/pg_regress --inputdir=$(srcdir) --temp-install=./tmp_check --top-builddir=$(top_builddir) $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
499-
pg_regress_installcheck = $(top_builddir)/src/test/regress/pg_regress --inputdir=$(srcdir) --psqldir='$(PSQLDIR)' $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
512+
pg_regress_check = $(with_temp_install) $(top_builddir)/src/test/regress/pg_regress --inputdir=$(srcdir) --temp-instance=./tmp_check --bindir= $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
513+
pg_regress_installcheck = $(top_builddir)/src/test/regress/pg_regress --inputdir=$(srcdir) --bindir='$(bindir)' $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
500514

501515
pg_regress_clean_files = results/ regression.diffs regression.out tmp_check/ log/
502516

503-
pg_isolation_regress_check = $(top_builddir)/src/test/isolation/pg_isolation_regress --inputdir=$(srcdir) --temp-install=./tmp_check --top-builddir=$(top_builddir) $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
504-
pg_isolation_regress_installcheck = $(top_builddir)/src/test/isolation/pg_isolation_regress --inputdir=$(srcdir) --top-builddir=$(top_builddir) $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
517+
pg_isolation_regress_check = $(with_temp_install) $(top_builddir)/src/test/isolation/pg_isolation_regress --inputdir=$(srcdir) --temp-instance=./tmp_check --bindir= $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
518+
pg_isolation_regress_installcheck = $(top_builddir)/src/test/isolation/pg_isolation_regress --inputdir=$(srcdir) $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
505519

506520
##########################################################################
507521
#
@@ -683,7 +697,7 @@ endif
683697
define _create_recursive_target
684698
.PHONY: $(1)-$(2)-recurse
685699
$(1): $(1)-$(2)-recurse
686-
$(1)-$(2)-recurse:
700+
$(1)-$(2)-recurse: $(if $(filter check, $(3)), temp-install)
687701
$$(MAKE) -C $(2) $(3)
688702
endef
689703
# Note that the use of $$ on the last line above is important; we want

src/bin/pg_upgrade/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ if [ "$1" = '--install' ]; then
8686
# use psql from the proper installation directory, which might
8787
# be outdated or missing. But don't override anything else that's
8888
# already in EXTRA_REGRESS_OPTS.
89-
EXTRA_REGRESS_OPTS="$EXTRA_REGRESS_OPTS --psqldir='$bindir'"
89+
EXTRA_REGRESS_OPTS="$EXTRA_REGRESS_OPTS --bindir='$bindir'"
9090
export EXTRA_REGRESS_OPTS
9191
fi
9292

src/interfaces/ecpg/test/Makefile

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,10 @@ override CPPFLAGS := \
1111
'-I$(top_builddir)/src/port' \
1212
'-I$(top_srcdir)/src/test/regress' \
1313
'-DHOST_TUPLE="$(host_tuple)"' \
14-
'-DMAKEPROG="$(MAKE)"' \
1514
'-DSHELLPROG="$(SHELL)"' \
1615
'-DDLSUFFIX="$(DLSUFFIX)"' \
1716
$(CPPFLAGS)
1817

19-
# where to find psql for testing an existing installation
20-
PSQLDIR = $(bindir)
21-
2218
# default encoding for regression tests
2319
ENCODING = SQL_ASCII
2420

@@ -82,11 +78,11 @@ endif
8278
REGRESS_OPTS = --dbname=regress1,connectdb --create-role=connectuser,connectdb $(EXTRA_REGRESS_OPTS)
8379

8480
check: all
85-
./pg_regress $(REGRESS_OPTS) --top-builddir=$(top_builddir) --temp-install=./tmp_check $(pg_regress_locale_flags) $(THREAD) --schedule=$(srcdir)/ecpg_schedule
81+
$(with_temp_install) ./pg_regress $(REGRESS_OPTS) --temp-instance=./tmp_check --bindir= $(pg_regress_locale_flags) $(THREAD) --schedule=$(srcdir)/ecpg_schedule
8682

8783
# the same options, but with --listen-on-tcp
8884
checktcp: all
89-
./pg_regress $(REGRESS_OPTS) --top-builddir=$(top_builddir) --temp-install=./tmp_check $(pg_regress_locale_flags) $(THREAD) --schedule=$(srcdir)/ecpg_schedule_tcp --host=localhost
85+
$(with_temp_install) ./pg_regress $(REGRESS_OPTS) --temp-instance=./tmp_check --bindir= $(pg_regress_locale_flags) $(THREAD) --schedule=$(srcdir)/ecpg_schedule_tcp --host=localhost
9086

9187
installcheck: all
92-
./pg_regress $(REGRESS_OPTS) --psqldir='$(PSQLDIR)' --top-builddir=$(top_builddir) $(pg_regress_locale_flags) $(THREAD) --schedule=$(srcdir)/ecpg_schedule
88+
./pg_regress $(REGRESS_OPTS) --bindir='$(bindir)' $(pg_regress_locale_flags) $(THREAD) --schedule=$(srcdir)/ecpg_schedule

src/makefiles/pgxs.mk

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,6 @@ else
258258
REGRESS_OPTS += --dbname=$(CONTRIB_TESTDB)
259259
endif
260260

261-
# where to find psql for running the tests
262-
PSQLDIR = $(bindir)
263-
264261
# When doing a VPATH build, must copy over the data files so that the
265262
# driver script can find them. We have to use an absolute path for
266263
# the targets, because otherwise make will try to locate the missing
@@ -295,7 +292,9 @@ check:
295292
@echo 'Do "$(MAKE) install", then "$(MAKE) installcheck" instead.'
296293
else
297294
check: all submake $(REGRESS_PREP)
298-
$(pg_regress_check) --extra-install=$(subdir) $(REGRESS_OPTS) $(REGRESS)
295+
$(pg_regress_check) $(REGRESS_OPTS) $(REGRESS)
296+
297+
temp-install: EXTRA_INSTALL=$(subdir)
299298
endif
300299
endif # REGRESS
301300

src/pl/plperl/GNUmakefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ ifeq ($(shell $(PERL) -V:usemultiplicity), usemultiplicity='define';)
6969
REGRESS += plperl_plperlu
7070
endif
7171
endif
72-
# where to find psql for running the tests
73-
PSQLDIR = $(bindir)
7472

7573
# where to find xsubpp for building XS.
7674
XSUBPPDIR = $(shell $(PERL) -e 'use List::Util qw(first); print first { -r "$$_/ExtUtils/xsubpp" } @INC')

src/pl/plpython/Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,6 @@ REGRESS = \
115115

116116
REGRESS_PLPYTHON3_MANGLE := $(REGRESS)
117117

118-
# where to find psql for running the tests
119-
PSQLDIR = $(bindir)
120-
121118
include $(top_srcdir)/src/Makefile.shlib
122119

123120
all: all-lib

src/pl/tcl/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ DATA = pltcl.control pltcl--1.0.sql pltcl--unpackaged--1.0.sql \
4545

4646
REGRESS_OPTS = --dbname=$(PL_TESTDB) --load-extension=pltcl
4747
REGRESS = pltcl_setup pltcl_queries
48-
# where to find psql for running the tests
49-
PSQLDIR = $(bindir)
5048

5149
# Tcl on win32 ships with import libraries only for Microsoft Visual C++,
5250
# which are not compatible with mingw gcc. Therefore we need to build a

src/test/isolation/Makefile

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ subdir = src/test/isolation
99
top_builddir = ../../..
1010
include $(top_builddir)/src/Makefile.global
1111

12-
# where to find psql for testing an existing installation
13-
PSQLDIR = $(bindir)
14-
1512
override CPPFLAGS := -I$(srcdir) -I$(libpq_srcdir) -I$(srcdir)/../regress $(CPPFLAGS)
1613

1714
OBJS = specparse.o isolationtester.o $(WIN32RES)
@@ -55,17 +52,17 @@ maintainer-clean: distclean
5552
rm -f specparse.c specscanner.c
5653

5754
installcheck: all
58-
./pg_isolation_regress --psqldir='$(PSQLDIR)' $(EXTRA_REGRESS_OPTS) --inputdir=$(srcdir) --schedule=$(srcdir)/isolation_schedule
55+
./pg_isolation_regress --bindir='$(bindir)' $(EXTRA_REGRESS_OPTS) --inputdir=$(srcdir) --schedule=$(srcdir)/isolation_schedule
5956

6057
check: all
61-
./pg_isolation_regress --temp-install=./tmp_check --inputdir=$(srcdir) --top-builddir=$(top_builddir) $(EXTRA_REGRESS_OPTS) --schedule=$(srcdir)/isolation_schedule
58+
$(with_temp_install) ./pg_isolation_regress --temp-instance=./tmp_check --inputdir=$(srcdir) --bindir= $(EXTRA_REGRESS_OPTS) --schedule=$(srcdir)/isolation_schedule
6259

6360
# Versions of the check tests that include the prepared_transactions test
6461
# It only makes sense to run these if set up to use prepared transactions,
6562
# via TEMP_CONFIG for the check case, or via the postgresql.conf for the
6663
# installcheck case.
67-
installcheck-prepared-txns: all
68-
./pg_isolation_regress --psqldir='$(PSQLDIR)' $(EXTRA_REGRESS_OPTS) --inputdir=$(srcdir) --schedule=$(srcdir)/isolation_schedule prepared-transactions
64+
installcheck-prepared-txns: all temp-install
65+
./pg_isolation_regress --bindir='$(bindir)' $(EXTRA_REGRESS_OPTS) --inputdir=$(srcdir) --schedule=$(srcdir)/isolation_schedule prepared-transactions
6966

70-
check-prepared-txns: all
71-
./pg_isolation_regress --temp-install=./tmp_check $(EXTRA_REGRESS_OPTS) --inputdir=$(srcdir) --top-builddir=$(top_builddir) --schedule=$(srcdir)/isolation_schedule prepared-transactions
67+
check-prepared-txns: all temp-install
68+
./pg_isolation_regress --temp-instance=./tmp_check $(EXTRA_REGRESS_OPTS) --inputdir=$(srcdir) --schedule=$(srcdir)/isolation_schedule prepared-transactions

src/test/regress/GNUmakefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ ifdef TEMP_CONFIG
2323
TEMP_CONF += --temp-config=$(TEMP_CONFIG)
2424
endif
2525

26-
# where to find psql for testing an existing installation
27-
PSQLDIR = $(bindir)
28-
2926
# maximum simultaneous connections for parallel tests
3027
MAXCONNOPT =
3128
ifdef MAX_CONNECTIONS
@@ -34,7 +31,6 @@ endif
3431

3532
# stuff to pass into build of pg_regress
3633
EXTRADEFS = '-DHOST_TUPLE="$(host_tuple)"' \
37-
'-DMAKEPROG="$(MAKE)"' \
3834
'-DSHELLPROG="$(SHELL)"' \
3935
'-DDLSUFFIX="$(DLSUFFIX)"'
4036

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy