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

Commit03faa4a

Browse files
committed
Add PGXS options to control TAP and isolation tests
The following options are added for extensions:- TAP_TESTS, to allow an extention to run TAP tests which are the onespresent in t/*.pl. A subset of tests can always be run with theexisting PROVE_TESTS for developers.- ISOLATION, to define a list of isolation tests.- ISOLATION_OPTS, to pass custom options to isolation_tester.A couple of custom Makefile targets have been accumulated across thetree to cover the lack of facility in PGXS for a couple of releases whenusing those test suites, which are all now replaced with the new flags,without reducing the test coverage. This also fixes an issue withcontrib/bloom/, which had a custom target to trigger its TAP tests ofits own not part of the main check runs.Author: Michael PaquierReviewed-by: Adam Berlin, Álvaro Herrera, Tom Lane, Nikolay Shaplov,Arthur ZakirovDiscussion:https://postgr.es/m/20180906014849.GG2726@paquier.xyz
1 parent2dedf4d commit03faa4a

File tree

11 files changed

+125
-133
lines changed

11 files changed

+125
-133
lines changed

‎contrib/bloom/Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ DATA = bloom--1.0.sql
88
PGFILEDESC = "bloom access method - signature file based index"
99

1010
REGRESS = bloom
11+
TAP_TESTS = 1
1112

1213
ifdefUSE_PGXS
1314
PG_CONFIG = pg_config
@@ -19,6 +20,3 @@ top_builddir = ../..
1920
include$(top_builddir)/src/Makefile.global
2021
include$(top_srcdir)/contrib/contrib-global.mk
2122
endif
22-
23-
wal-check: temp-install
24-
$(prove_check)

‎contrib/oid2name/Makefile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ PGAPPICON = win32
66
PROGRAM = oid2name
77
OBJS= oid2name.o$(WIN32RES)
88

9+
TAP_TESTS = 1
10+
911
PG_CPPFLAGS = -I$(libpq_srcdir)
1012
PG_LIBS_INTERNAL =$(libpq_pgport)
1113

12-
EXTRA_CLEAN = tmp_check
13-
1414
ifdefUSE_PGXS
1515
PG_CONFIG = pg_config
1616
PGXS :=$(shell$(PG_CONFIG) --pgxs)
@@ -21,9 +21,3 @@ top_builddir = ../..
2121
include$(top_builddir)/src/Makefile.global
2222
include$(top_srcdir)/contrib/contrib-global.mk
2323
endif
24-
25-
check:
26-
$(prove_check)
27-
28-
installcheck:
29-
$(prove_installcheck)

‎contrib/test_decoding/Makefile

Lines changed: 17 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,20 @@
33
MODULES = test_decoding
44
PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
55

6-
# Note: because we don't tell the Makefile there are any regression tests,
7-
# we have to clean those result files explicitly
8-
EXTRA_CLEAN =$(pg_regress_clean_files)
6+
EXTRA_INSTALL=contrib/test_decoding
7+
8+
REGRESS = ddl xact rewrite toast permissions decoding_in_xact\
9+
decoding_into_rel binary prepared replorigin time messages\
10+
spill slot truncate
11+
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml\
12+
oldest_xmin snapshot_transfer
13+
14+
REGRESS_OPTS = --temp-config$(top_srcdir)/contrib/test_decoding/logical.conf
15+
ISOLATION_OPTS = --temp-config$(top_srcdir)/contrib/test_decoding/logical.conf
16+
17+
# Disabled because these tests require "wal_level=logical", which
18+
# typical installcheck users do not have (e.g. buildfarm clients).
19+
NO_INSTALLCHECK = 1
920

1021
ifdefUSE_PGXS
1122
PG_CONFIG = pg_config
@@ -18,52 +29,8 @@ include $(top_builddir)/src/Makefile.global
1829
include$(top_srcdir)/contrib/contrib-global.mk
1930
endif
2031

21-
# Disabled because these tests require "wal_level=logical", which
22-
# typical installcheck users do not have (e.g. buildfarm clients).
23-
installcheck:;
24-
2532
# But it can nonetheless be very helpful to run tests on preexisting
2633
# installation, allow to do so, but only if requested explicitly.
27-
installcheck-force: regresscheck-install-force isolationcheck-install-force
28-
29-
check: regresscheck isolationcheck
30-
31-
submake-regress:
32-
$(MAKE) -C$(top_builddir)/src/test/regress all
33-
34-
submake-isolation:
35-
$(MAKE) -C$(top_builddir)/src/test/isolation all
36-
37-
submake-test_decoding:
38-
$(MAKE) -C$(top_builddir)/contrib/test_decoding
39-
40-
REGRESSCHECKS=ddl xact rewrite toast permissions decoding_in_xact\
41-
decoding_into_rel binary prepared replorigin time messages\
42-
spill slot truncate
43-
44-
regresscheck: | submake-regress submake-test_decoding temp-install
45-
$(pg_regress_check)\
46-
--temp-config$(top_srcdir)/contrib/test_decoding/logical.conf\
47-
$(REGRESSCHECKS)
48-
49-
regresscheck-install-force: | submake-regress submake-test_decoding temp-install
50-
$(pg_regress_installcheck)\
51-
$(REGRESSCHECKS)
52-
53-
ISOLATIONCHECKS=mxact delayed_startup ondisk_startup concurrent_ddl_dml\
54-
oldest_xmin snapshot_transfer
55-
56-
isolationcheck: | submake-isolation submake-test_decoding temp-install
57-
$(pg_isolation_regress_check)\
58-
--temp-config$(top_srcdir)/contrib/test_decoding/logical.conf\
59-
$(ISOLATIONCHECKS)
60-
61-
isolationcheck-install-force: all | submake-isolation submake-test_decoding temp-install
62-
$(pg_isolation_regress_installcheck)\
63-
$(ISOLATIONCHECKS)
64-
65-
.PHONY: submake-test_decoding submake-regress check\
66-
regresscheck regresscheck-install-force\
67-
isolationcheck isolationcheck-install-force
68-
69-
temp-install: EXTRA_INSTALL=contrib/test_decoding
34+
installcheck-force:
35+
$(pg_regress_installcheck)$(REGRESS)
36+
$(pg_isolation_regress_installcheck)$(ISOLATION)

‎contrib/vacuumlo/Makefile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ PGAPPICON = win32
66
PROGRAM = vacuumlo
77
OBJS= vacuumlo.o$(WIN32RES)
88

9+
TAP_TESTS = 1
10+
911
PG_CPPFLAGS = -I$(libpq_srcdir)
1012
PG_LIBS_INTERNAL =$(libpq_pgport)
1113

12-
EXTRA_CLEAN = tmp_check
13-
1414
ifdefUSE_PGXS
1515
PG_CONFIG = pg_config
1616
PGXS :=$(shell$(PG_CONFIG) --pgxs)
@@ -21,9 +21,3 @@ top_builddir = ../..
2121
include$(top_builddir)/src/Makefile.global
2222
include$(top_srcdir)/contrib/contrib-global.mk
2323
endif
24-
25-
check:
26-
$(prove_check)
27-
28-
installcheck:
29-
$(prove_installcheck)

‎doc/src/sgml/extend.sgml

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,6 +1303,34 @@ include $(PGXS)
13031303
</listitem>
13041304
</varlistentry>
13051305

1306+
<varlistentry>
1307+
<term><varname>ISOLATION</varname></term>
1308+
<listitem>
1309+
<para>
1310+
list of isolation test cases, see below for more details
1311+
</para>
1312+
</listitem>
1313+
</varlistentry>
1314+
1315+
<varlistentry>
1316+
<term><varname>ISOLATION_OPTS</varname></term>
1317+
<listitem>
1318+
<para>
1319+
additional switches to pass to
1320+
<application>pg_isolation_regress</application>
1321+
</para>
1322+
</listitem>
1323+
</varlistentry>
1324+
1325+
<varlistentry>
1326+
<term><varname>TAP_TESTS</varname></term>
1327+
<listitem>
1328+
<para>
1329+
switch defining if TAP tests need to be run, see below
1330+
</para>
1331+
</listitem>
1332+
</varlistentry>
1333+
13061334
<varlistentry>
13071335
<term><varname>NO_INSTALLCHECK</varname></term>
13081336
<listitem>
@@ -1423,13 +1451,42 @@ make VPATH=/path/to/extension/source/tree install
14231451
have all expected files.
14241452
</para>
14251453

1454+
<para>
1455+
The scripts listed in the <varname>ISOLATION</varname> variable are used
1456+
for tests stressing behavior of concurrent session with your module, which
1457+
can be invoked by <literal>make installcheck</literal> after doing
1458+
<literal>make install</literal>. For this to work you must have a
1459+
running <productname>PostgreSQL</productname> server. The script files
1460+
listed in <varname>ISOLATION</varname> must appear in a subdirectory
1461+
named <literal>specs/</literal> in your extension's directory. These files
1462+
must have extension <literal>.spec</literal>, which must not be included
1463+
in the <varname>ISOLATION</varname> list in the makefile. For each test
1464+
there should also be a file containing the expected output in a
1465+
subdirectory named <literal>expected/</literal>, with the same stem and
1466+
extension <literal>.out</literal>. <literal>make installcheck</literal>
1467+
executes each test script, and compares the resulting output to the
1468+
matching expected file. Any differences will be written to the file
1469+
<literal>output_iso/regression.diffs</literal> in
1470+
<command>diff -c</command> format. Note that trying to run a test that is
1471+
missing its expected file will be reported as <quote>trouble</quote>, so
1472+
make sure you have all expected files.
1473+
</para>
1474+
1475+
<para>
1476+
<literal>TAP_TESTS</literal> enables the use of TAP tests. Data from each
1477+
run is present in a subdirectory named <literal>tmp_check/</literal>.
1478+
See also <xref linkend="regress-tap"/> for more details.
1479+
</para>
1480+
14261481
<tip>
14271482
<para>
14281483
The easiest way to create the expected files is to create empty files,
14291484
then do a test run (which will of course report differences). Inspect
14301485
the actual result files found in the <literal>results/</literal>
1431-
directory, then copy them to <literal>expected/</literal> if they match
1432-
what you expect from the test.
1486+
directory (for tests in <literal>REGRESS</literal>), or
1487+
<literal>output_iso/results/</literal> directory (for tests in
1488+
<literal>ISOLATION</literal>), then copy them to
1489+
<literal>expected/</literal> if they match what you expect from the test.
14331490
</para>
14341491

14351492
</tip>

‎src/makefiles/pgxs.mk

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@
4646
# HEADERS_built_$(MODULE) -- as above but built first (also NOT cleaned)
4747
# REGRESS -- list of regression test cases (without suffix)
4848
# REGRESS_OPTS -- additional switches to pass to pg_regress
49+
# TAP_TESTS -- switch to enable TAP tests
50+
# ISOLATION -- list of isolation test cases
51+
# ISOLATION_OPTS -- additional switches to pass to pg_isolation_regress
4952
# NO_INSTALLCHECK -- don't define an installcheck target, useful e.g. if
5053
# tests require special configuration, or don't use pg_regress
5154
# EXTRA_CLEAN -- extra files to remove in 'make clean'
@@ -349,6 +352,12 @@ ifeq ($(PORTNAME), win)
349352
rm -f regress.def
350353
endif
351354
endif# REGRESS
355+
ifdefTAP_TESTS
356+
rm -rf tmp_check/
357+
endif
358+
ifdefISOLATION
359+
rm -rf output_iso/ tmp_check_iso/
360+
endif
352361

353362
ifdefMODULE_big
354363
clean: clean-lib
@@ -383,28 +392,47 @@ $(test_files_build): $(abs_builddir)/%: $(srcdir)/%
383392
$(MKDIR_P)$(dir$@)
384393
ln -s$<$@
385394
endif# VPATH
395+
endif# REGRESS
386396

387397
.PHONY: submake
388398
submake:
389399
ifndefPGXS
390400
$(MAKE) -C $(top_builddir)/src/test/regress pg_regress$(X)
401+
$(MAKE) -C $(top_builddir)/src/test/isolation all
391402
endif
392403

393-
# against installed postmaster
404+
# Standard rules to run regression tests including multiple test suites.
405+
# Runs against an installed postmaster
394406
ifndefNO_INSTALLCHECK
395407
installcheck: submake$(REGRESS_PREP)
408+
ifdefREGRESS
396409
$(pg_regress_installcheck) $(REGRESS_OPTS) $(REGRESS)
397410
endif
411+
ifdefISOLATION
412+
$(pg_isolation_regress_installcheck) $(ISOLATION_OPTS) $(ISOLATION)
413+
endif
414+
ifdefTAP_TESTS
415+
$(prove_installcheck)
416+
endif
417+
endif# NO_INSTALLCHECK
398418

419+
# Runs independently of any installation
399420
ifdefPGXS
400421
check:
401422
@echo'"$(MAKE) check" is not supported.'
402423
@echo'Do "$(MAKE) install", then "$(MAKE) installcheck" instead.'
403424
else
404425
check: submake$(REGRESS_PREP)
426+
ifdefREGRESS
405427
$(pg_regress_check) $(REGRESS_OPTS) $(REGRESS)
406428
endif
407-
endif# REGRESS
429+
ifdefISOLATION
430+
$(pg_isolation_regress_check) $(ISOLATION_OPTS) $(ISOLATION)
431+
endif
432+
ifdefTAP_TESTS
433+
$(prove_check)
434+
endif
435+
endif# PGXS
408436

409437
ifndefNO_TEMP_INSTALL
410438
temp-install: EXTRA_INSTALL+=$(subdir)

‎src/test/modules/brin/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Generated subdirectories
2-
/isolation_output/
2+
/output_iso/
33
/tmp_check/

‎src/test/modules/brin/Makefile

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
# src/test/modules/brin/Makefile
22

3-
# Note: because we don't tell the Makefile there are any regression tests,
4-
# we have to clean those result files explicitly
5-
EXTRA_CLEAN =$(pg_regress_clean_files) ./isolation_output
3+
EXTRA_INSTALL = contrib/pageinspect
64

7-
EXTRA_INSTALL=contrib/pageinspect
8-
9-
ISOLATIONCHECKS=summarization-and-inprogress-insertion
5+
ISOLATION = summarization-and-inprogress-insertion
6+
TAP_TESTS = 1
107

118
ifdefUSE_PGXS
129
PG_CONFIG = pg_config
@@ -18,19 +15,3 @@ top_builddir = ../../../..
1815
include$(top_builddir)/src/Makefile.global
1916
include$(top_srcdir)/contrib/contrib-global.mk
2017
endif
21-
22-
check: isolation-check prove-check
23-
24-
isolation-check: | submake-isolation temp-install
25-
$(MKDIR_P) isolation_output
26-
$(pg_isolation_regress_check)\
27-
--outputdir=./isolation_output\
28-
$(ISOLATIONCHECKS)
29-
30-
prove-check: | temp-install
31-
$(prove_check)
32-
33-
.PHONY: check isolation-check prove-check
34-
35-
submake-isolation:
36-
$(MAKE) -C$(top_builddir)/src/test/isolation all

‎src/test/modules/commit_ts/Makefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
REGRESS = commit_timestamp
44
REGRESS_OPTS = --temp-config=$(top_srcdir)/src/test/modules/commit_ts/commit_ts.conf
5+
TAP_TESTS = 1
56

67
ifdefUSE_PGXS
78
PG_CONFIG = pg_config
@@ -13,8 +14,3 @@ top_builddir = ../../../..
1314
include$(top_builddir)/src/Makefile.global
1415
include$(top_srcdir)/contrib/contrib-global.mk
1516
endif
16-
17-
check: prove-check
18-
19-
prove-check: | temp-install
20-
$(prove_check)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp