mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-18 18:44:06 +08:00
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
This commit is contained in:
parent
eb4da3e380
commit
60f826c5e6
5
contrib/test_decoding/.gitignore
vendored
5
contrib/test_decoding/.gitignore
vendored
@ -1,5 +1,6 @@
|
|||||||
# Generated subdirectories
|
# Generated subdirectories
|
||||||
/log/
|
/log/
|
||||||
/isolation_output/
|
/results/
|
||||||
/regression_output/
|
/output_iso/
|
||||||
/tmp_check/
|
/tmp_check/
|
||||||
|
/tmp_check_iso/
|
||||||
|
@ -5,7 +5,7 @@ PGFILEDESC = "test_decoding - example of a logical decoding output plugin"
|
|||||||
|
|
||||||
# Note: because we don't tell the Makefile there are any regression tests,
|
# Note: because we don't tell the Makefile there are any regression tests,
|
||||||
# we have to clean those result files explicitly
|
# we have to clean those result files explicitly
|
||||||
EXTRA_CLEAN = $(pg_regress_clean_files) ./regression_output ./isolation_output
|
EXTRA_CLEAN = $(pg_regress_clean_files)
|
||||||
|
|
||||||
ifdef USE_PGXS
|
ifdef USE_PGXS
|
||||||
PG_CONFIG = pg_config
|
PG_CONFIG = pg_config
|
||||||
@ -42,11 +42,8 @@ REGRESSCHECKS=ddl xact rewrite toast permissions decoding_in_xact \
|
|||||||
spill slot
|
spill slot
|
||||||
|
|
||||||
regresscheck: | submake-regress submake-test_decoding temp-install
|
regresscheck: | submake-regress submake-test_decoding temp-install
|
||||||
$(MKDIR_P) regression_output
|
|
||||||
$(pg_regress_check) \
|
$(pg_regress_check) \
|
||||||
--temp-config $(top_srcdir)/contrib/test_decoding/logical.conf \
|
--temp-config $(top_srcdir)/contrib/test_decoding/logical.conf \
|
||||||
--temp-instance=./tmp_check \
|
|
||||||
--outputdir=./regression_output \
|
|
||||||
$(REGRESSCHECKS)
|
$(REGRESSCHECKS)
|
||||||
|
|
||||||
regresscheck-install-force: | submake-regress submake-test_decoding temp-install
|
regresscheck-install-force: | submake-regress submake-test_decoding temp-install
|
||||||
@ -56,10 +53,8 @@ regresscheck-install-force: | submake-regress submake-test_decoding temp-install
|
|||||||
ISOLATIONCHECKS=mxact delayed_startup ondisk_startup concurrent_ddl_dml
|
ISOLATIONCHECKS=mxact delayed_startup ondisk_startup concurrent_ddl_dml
|
||||||
|
|
||||||
isolationcheck: | submake-isolation submake-test_decoding temp-install
|
isolationcheck: | submake-isolation submake-test_decoding temp-install
|
||||||
$(MKDIR_P) isolation_output
|
|
||||||
$(pg_isolation_regress_check) \
|
$(pg_isolation_regress_check) \
|
||||||
--temp-config $(top_srcdir)/contrib/test_decoding/logical.conf \
|
--temp-config $(top_srcdir)/contrib/test_decoding/logical.conf \
|
||||||
--outputdir=./isolation_output \
|
|
||||||
$(ISOLATIONCHECKS)
|
$(ISOLATIONCHECKS)
|
||||||
|
|
||||||
isolationcheck-install-force: all | submake-isolation submake-test_decoding temp-install
|
isolationcheck-install-force: all | submake-isolation submake-test_decoding temp-install
|
||||||
|
@ -545,14 +545,31 @@ TEMP_CONF += --temp-config=$(TEMP_CONFIG)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
pg_regress_locale_flags = $(if $(ENCODING),--encoding=$(ENCODING)) $(NOLOCALE)
|
pg_regress_locale_flags = $(if $(ENCODING),--encoding=$(ENCODING)) $(NOLOCALE)
|
||||||
|
pg_regress_clean_files = results/ regression.diffs regression.out tmp_check/ tmp_check_iso/ log/ output_iso/
|
||||||
|
|
||||||
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)
|
pg_regress_check = \
|
||||||
pg_regress_installcheck = $(top_builddir)/src/test/regress/pg_regress --inputdir=$(srcdir) --bindir='$(bindir)' $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
|
$(with_temp_install) \
|
||||||
|
$(top_builddir)/src/test/regress/pg_regress \
|
||||||
|
--temp-instance=./tmp_check \
|
||||||
|
--inputdir=$(srcdir) \
|
||||||
|
$(TEMP_CONF) \
|
||||||
|
--bindir= $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
|
||||||
|
pg_regress_installcheck = \
|
||||||
|
$(top_builddir)/src/test/regress/pg_regress \
|
||||||
|
--inputdir=$(srcdir) \
|
||||||
|
--bindir='$(bindir)' $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
|
||||||
|
|
||||||
pg_regress_clean_files = results/ regression.diffs regression.out tmp_check/ log/
|
pg_isolation_regress_check = \
|
||||||
|
$(with_temp_install) \
|
||||||
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)
|
$(top_builddir)/src/test/isolation/pg_isolation_regress \
|
||||||
pg_isolation_regress_installcheck = $(top_builddir)/src/test/isolation/pg_isolation_regress --inputdir=$(srcdir) $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
|
--temp-instance=./tmp_check_iso \
|
||||||
|
--inputdir=$(srcdir) --outputdir=output_iso \
|
||||||
|
$(TEMP_CONF) \
|
||||||
|
--bindir= $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
|
||||||
|
pg_isolation_regress_installcheck = \
|
||||||
|
$(top_builddir)/src/test/isolation/pg_isolation_regress \
|
||||||
|
--inputdir=$(srcdir) \
|
||||||
|
$(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
#
|
#
|
||||||
|
5
src/test/isolation/.gitignore
vendored
5
src/test/isolation/.gitignore
vendored
@ -7,6 +7,5 @@
|
|||||||
/specscanner.c
|
/specscanner.c
|
||||||
|
|
||||||
# Generated subdirectories
|
# Generated subdirectories
|
||||||
/results/
|
/output_iso/
|
||||||
/log/
|
/tmp_check_iso/
|
||||||
/tmp_check/
|
|
||||||
|
@ -52,17 +52,17 @@ maintainer-clean: distclean
|
|||||||
rm -f specparse.c specscanner.c
|
rm -f specparse.c specscanner.c
|
||||||
|
|
||||||
installcheck: all
|
installcheck: all
|
||||||
./pg_isolation_regress --bindir='$(bindir)' $(EXTRA_REGRESS_OPTS) --inputdir=$(srcdir) --schedule=$(srcdir)/isolation_schedule
|
$(pg_isolation_regress_installcheck) --schedule=$(srcdir)/isolation_schedule
|
||||||
|
|
||||||
check: all
|
check: all
|
||||||
$(with_temp_install) ./pg_isolation_regress --temp-instance=./tmp_check $(TEMP_CONF) --inputdir=$(srcdir) --bindir= $(EXTRA_REGRESS_OPTS) --schedule=$(srcdir)/isolation_schedule
|
$(pg_isolation_regress_check) --schedule=$(srcdir)/isolation_schedule
|
||||||
|
|
||||||
# Versions of the check tests that include the prepared_transactions test
|
# Versions of the check tests that include the prepared_transactions test
|
||||||
# It only makes sense to run these if set up to use prepared transactions,
|
# It only makes sense to run these if set up to use prepared transactions,
|
||||||
# via TEMP_CONFIG for the check case, or via the postgresql.conf for the
|
# via TEMP_CONFIG for the check case, or via the postgresql.conf for the
|
||||||
# installcheck case.
|
# installcheck case.
|
||||||
installcheck-prepared-txns: all temp-install
|
installcheck-prepared-txns: all temp-install
|
||||||
./pg_isolation_regress --bindir='$(bindir)' $(EXTRA_REGRESS_OPTS) --inputdir=$(srcdir) --schedule=$(srcdir)/isolation_schedule prepared-transactions
|
$(pg_isolation_regress_installcheck) --schedule=$(srcdir)/isolation_schedule prepared-transactions
|
||||||
|
|
||||||
check-prepared-txns: all temp-install
|
check-prepared-txns: all temp-install
|
||||||
./pg_isolation_regress --temp-instance=./tmp_check $(TEMP_CONF) $(EXTRA_REGRESS_OPTS) --inputdir=$(srcdir) --schedule=$(srcdir)/isolation_schedule prepared-transactions
|
$(pg_isolation_regress_check) --schedule=$(srcdir)/isolation_schedule prepared-transactions
|
||||||
|
2
src/test/modules/snapshot_too_old/.gitignore
vendored
2
src/test/modules/snapshot_too_old/.gitignore
vendored
@ -1 +1 @@
|
|||||||
/isolation_output/
|
/output_iso/
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
# src/test/modules/snapshot_too_old/Makefile
|
# src/test/modules/snapshot_too_old/Makefile
|
||||||
|
|
||||||
EXTRA_CLEAN = ./isolation_output
|
# Note: because we don't tell the Makefile there are any regression tests,
|
||||||
|
# we have to clean those result files explicitly
|
||||||
|
EXTRA_CLEAN = $(pg_regress_clean_files)
|
||||||
|
|
||||||
ISOLATIONCHECKS=sto_using_cursor sto_using_select
|
ISOLATIONCHECKS=sto_using_cursor sto_using_select
|
||||||
|
|
||||||
@ -32,10 +34,8 @@ submake-test_snapshot_too_old:
|
|||||||
$(MAKE) -C $(top_builddir)/src/test/modules/snapshot_too_old
|
$(MAKE) -C $(top_builddir)/src/test/modules/snapshot_too_old
|
||||||
|
|
||||||
isolationcheck: | submake-isolation submake-test_snapshot_too_old temp-install
|
isolationcheck: | submake-isolation submake-test_snapshot_too_old temp-install
|
||||||
$(MKDIR_P) isolation_output
|
|
||||||
$(pg_isolation_regress_check) \
|
$(pg_isolation_regress_check) \
|
||||||
--temp-config $(top_srcdir)/src/test/modules/snapshot_too_old/sto.conf \
|
--temp-config $(top_srcdir)/src/test/modules/snapshot_too_old/sto.conf \
|
||||||
--outputdir=./isolation_output \
|
|
||||||
$(ISOLATIONCHECKS)
|
$(ISOLATIONCHECKS)
|
||||||
|
|
||||||
isolationcheck-install-force: all | submake-isolation submake-test_snapshot_too_old temp-install
|
isolationcheck-install-force: all | submake-isolation submake-test_snapshot_too_old temp-install
|
||||||
|
@ -1871,6 +1871,10 @@ open_result_files(void)
|
|||||||
char file[MAXPGPATH];
|
char file[MAXPGPATH];
|
||||||
FILE *difffile;
|
FILE *difffile;
|
||||||
|
|
||||||
|
/* create outputdir directory if not present */
|
||||||
|
if (!directory_exists(outputdir))
|
||||||
|
make_directory(outputdir);
|
||||||
|
|
||||||
/* create the log file (copy of running status output) */
|
/* create the log file (copy of running status output) */
|
||||||
snprintf(file, sizeof(file), "%s/regression.out", outputdir);
|
snprintf(file, sizeof(file), "%s/regression.out", outputdir);
|
||||||
logfilename = pg_strdup(file);
|
logfilename = pg_strdup(file);
|
||||||
@ -1895,7 +1899,7 @@ open_result_files(void)
|
|||||||
/* we don't keep the diffs file open continuously */
|
/* we don't keep the diffs file open continuously */
|
||||||
fclose(difffile);
|
fclose(difffile);
|
||||||
|
|
||||||
/* also create the output directory if not present */
|
/* also create the results directory if not present */
|
||||||
snprintf(file, sizeof(file), "%s/results", outputdir);
|
snprintf(file, sizeof(file), "%s/results", outputdir);
|
||||||
if (!directory_exists(file))
|
if (!directory_exists(file))
|
||||||
make_directory(file);
|
make_directory(file);
|
||||||
|
Loading…
Reference in New Issue
Block a user