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

Commit 60f826c

Browse files
committed
Improve isolation tests infrastructure.
Previously if a directory had both isolationtester and plain regression tests, they couldn't be run in parallel, because they'd access the same files/directories. That, so far, only affected contrib/test_decoding. Rather than fix that locally in contrib/test_decoding, improve pg_regress_isolation_[install]check to use separate resources from plain regression tests. That requires a minor change in pg_regress, namely that the --outputdir is created if not already existing, that seems like good idea anyway. Use the improved helpers even where previously not used. Author: Tom Lane and Andres Freund Discussion: https://postgr.es/m/20170311194831.vm5ikpczq52c2drg@alap3.anarazel.de
1 parent eb4da3e commit 60f826c

File tree

8 files changed

+44
-28
lines changed

8 files changed

+44
-28
lines changed

contrib/test_decoding/.gitignore

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Generated subdirectories
22
/log/
3-
/isolation_output/
4-
/regression_output/
3+
/results/
4+
/output_iso/
55
/tmp_check/
6+
/tmp_check_iso/

contrib/test_decoding/Makefile

+1-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
55

66
# Note: because we don't tell the Makefile there are any regression tests,
77
# we have to clean those result files explicitly
8-
EXTRA_CLEAN = $(pg_regress_clean_files) ./regression_output ./isolation_output
8+
EXTRA_CLEAN = $(pg_regress_clean_files)
99

1010
ifdef USE_PGXS
1111
PG_CONFIG = pg_config
@@ -42,11 +42,8 @@ REGRESSCHECKS=ddl xact rewrite toast permissions decoding_in_xact \
4242
spill slot
4343

4444
regresscheck: | submake-regress submake-test_decoding temp-install
45-
$(MKDIR_P) regression_output
4645
$(pg_regress_check) \
4746
--temp-config $(top_srcdir)/contrib/test_decoding/logical.conf \
48-
--temp-instance=./tmp_check \
49-
--outputdir=./regression_output \
5047
$(REGRESSCHECKS)
5148

5249
regresscheck-install-force: | submake-regress submake-test_decoding temp-install
@@ -56,10 +53,8 @@ regresscheck-install-force: | submake-regress submake-test_decoding temp-install
5653
ISOLATIONCHECKS=mxact delayed_startup ondisk_startup concurrent_ddl_dml
5754

5855
isolationcheck: | submake-isolation submake-test_decoding temp-install
59-
$(MKDIR_P) isolation_output
6056
$(pg_isolation_regress_check) \
6157
--temp-config $(top_srcdir)/contrib/test_decoding/logical.conf \
62-
--outputdir=./isolation_output \
6358
$(ISOLATIONCHECKS)
6459

6560
isolationcheck-install-force: all | submake-isolation submake-test_decoding temp-install

src/Makefile.global.in

+25-8
Original file line numberDiff line numberDiff line change
@@ -545,14 +545,31 @@ TEMP_CONF += --temp-config=$(TEMP_CONFIG)
545545
endif
546546

547547
pg_regress_locale_flags = $(if $(ENCODING),--encoding=$(ENCODING)) $(NOLOCALE)
548-
549-
pg_regress_check = $(with_temp_install) $(top_builddir)/src/test/regress/pg_regress --inputdir=$(srcdir) --temp-instance=./tmp_check $(TEMP_CONF) --bindir= $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
550-
pg_regress_installcheck = $(top_builddir)/src/test/regress/pg_regress --inputdir=$(srcdir) --bindir='$(bindir)' $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
551-
552-
pg_regress_clean_files = results/ regression.diffs regression.out tmp_check/ log/
553-
554-
pg_isolation_regress_check = $(with_temp_install) $(top_builddir)/src/test/isolation/pg_isolation_regress --inputdir=$(srcdir) --temp-instance=./tmp_check $(TEMP_CONF) --bindir= $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
555-
pg_isolation_regress_installcheck = $(top_builddir)/src/test/isolation/pg_isolation_regress --inputdir=$(srcdir) $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
548+
pg_regress_clean_files = results/ regression.diffs regression.out tmp_check/ tmp_check_iso/ log/ output_iso/
549+
550+
pg_regress_check = \
551+
$(with_temp_install) \
552+
$(top_builddir)/src/test/regress/pg_regress \
553+
--temp-instance=./tmp_check \
554+
--inputdir=$(srcdir) \
555+
$(TEMP_CONF) \
556+
--bindir= $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
557+
pg_regress_installcheck = \
558+
$(top_builddir)/src/test/regress/pg_regress \
559+
--inputdir=$(srcdir) \
560+
--bindir='$(bindir)' $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
561+
562+
pg_isolation_regress_check = \
563+
$(with_temp_install) \
564+
$(top_builddir)/src/test/isolation/pg_isolation_regress \
565+
--temp-instance=./tmp_check_iso \
566+
--inputdir=$(srcdir) --outputdir=output_iso \
567+
$(TEMP_CONF) \
568+
--bindir= $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
569+
pg_isolation_regress_installcheck = \
570+
$(top_builddir)/src/test/isolation/pg_isolation_regress \
571+
--inputdir=$(srcdir) \
572+
$(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
556573

557574
##########################################################################
558575
#

src/test/isolation/.gitignore

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@
77
/specscanner.c
88

99
# Generated subdirectories
10-
/results/
11-
/log/
12-
/tmp_check/
10+
/output_iso/
11+
/tmp_check_iso/

src/test/isolation/Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,17 @@ maintainer-clean: distclean
5252
rm -f specparse.c specscanner.c
5353

5454
installcheck: all
55-
./pg_isolation_regress --bindir='$(bindir)' $(EXTRA_REGRESS_OPTS) --inputdir=$(srcdir) --schedule=$(srcdir)/isolation_schedule
55+
$(pg_isolation_regress_installcheck) --schedule=$(srcdir)/isolation_schedule
5656

5757
check: all
58-
$(with_temp_install) ./pg_isolation_regress --temp-instance=./tmp_check $(TEMP_CONF) --inputdir=$(srcdir) --bindir= $(EXTRA_REGRESS_OPTS) --schedule=$(srcdir)/isolation_schedule
58+
$(pg_isolation_regress_check) --schedule=$(srcdir)/isolation_schedule
5959

6060
# Versions of the check tests that include the prepared_transactions test
6161
# It only makes sense to run these if set up to use prepared transactions,
6262
# via TEMP_CONFIG for the check case, or via the postgresql.conf for the
6363
# installcheck case.
6464
installcheck-prepared-txns: all temp-install
65-
./pg_isolation_regress --bindir='$(bindir)' $(EXTRA_REGRESS_OPTS) --inputdir=$(srcdir) --schedule=$(srcdir)/isolation_schedule prepared-transactions
65+
$(pg_isolation_regress_installcheck) --schedule=$(srcdir)/isolation_schedule prepared-transactions
6666

6767
check-prepared-txns: all temp-install
68-
./pg_isolation_regress --temp-instance=./tmp_check $(TEMP_CONF) $(EXTRA_REGRESS_OPTS) --inputdir=$(srcdir) --schedule=$(srcdir)/isolation_schedule prepared-transactions
68+
$(pg_isolation_regress_check) --schedule=$(srcdir)/isolation_schedule prepared-transactions
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/isolation_output/
1+
/output_iso/

src/test/modules/snapshot_too_old/Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# src/test/modules/snapshot_too_old/Makefile
22

3-
EXTRA_CLEAN = ./isolation_output
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)
46

57
ISOLATIONCHECKS=sto_using_cursor sto_using_select
68

@@ -32,10 +34,8 @@ submake-test_snapshot_too_old:
3234
$(MAKE) -C $(top_builddir)/src/test/modules/snapshot_too_old
3335

3436
isolationcheck: | submake-isolation submake-test_snapshot_too_old temp-install
35-
$(MKDIR_P) isolation_output
3637
$(pg_isolation_regress_check) \
3738
--temp-config $(top_srcdir)/src/test/modules/snapshot_too_old/sto.conf \
38-
--outputdir=./isolation_output \
3939
$(ISOLATIONCHECKS)
4040

4141
isolationcheck-install-force: all | submake-isolation submake-test_snapshot_too_old temp-install

src/test/regress/pg_regress.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -1871,6 +1871,10 @@ open_result_files(void)
18711871
char file[MAXPGPATH];
18721872
FILE *difffile;
18731873

1874+
/* create outputdir directory if not present */
1875+
if (!directory_exists(outputdir))
1876+
make_directory(outputdir);
1877+
18741878
/* create the log file (copy of running status output) */
18751879
snprintf(file, sizeof(file), "%s/regression.out", outputdir);
18761880
logfilename = pg_strdup(file);
@@ -1895,7 +1899,7 @@ open_result_files(void)
18951899
/* we don't keep the diffs file open continuously */
18961900
fclose(difffile);
18971901

1898-
/* also create the output directory if not present */
1902+
/* also create the results directory if not present */
18991903
snprintf(file, sizeof(file), "%s/results", outputdir);
19001904
if (!directory_exists(file))
19011905
make_directory(file);

0 commit comments

Comments
 (0)