7a3996
#
7a3996
# Simplified makefile for running the PostgreSQL regression tests
7a3996
# in an RPM installation
7a3996
#
7a3996
7a3996
# maximum simultaneous connections for parallel tests
7a3996
MAXCONNOPT =
7a3996
ifdef MAX_CONNECTIONS
7a3996
MAXCONNOPT += --max-connections=$(MAX_CONNECTIONS)
7a3996
endif
7a3996
7a3996
# locale
7a3996
NOLOCALE =
7a3996
ifdef NO_LOCALE
7a3996
NOLOCALE += --no-locale
7a3996
endif
7a3996
7a3996
srcdir := .
7a3996
7a3996
REGRESS_OPTS += --dlpath=.
7a3996
7a3996
pg_regress_locale_flags = $(if $(ENCODING),--encoding=$(ENCODING)) $(NOLOCALE)
7a3996
7a3996
pg_regress_installcheck = ./pg_regress --inputdir=$(srcdir) --bindir=@bindir@ $(pg_regress_locale_flags)
7a3996
7a3996
# Test input and expected files.  These are created by pg_regress itself, so we
7a3996
# don't have a rule to create them.  We do need rules to clean them however.
7a3996
ifile_list := $(subst .source,, $(notdir $(wildcard $(srcdir)/input/*.source)))
7a3996
input_files  := $(foreach file, $(ifile_list), sql/$(file).sql)
7a3996
ofile_list := $(subst .source,, $(notdir $(wildcard $(srcdir)/output/*.source)))
7a3996
output_files := $(foreach file, $(ofile_list), expected/$(file).out)
7a3996
7a3996
abs_srcdir := $(shell pwd)
7a3996
abs_builddir := $(shell pwd)
7a3996
7a3996
check: installcheck-parallel
7a3996
7a3996
installcheck: cleandirs
7a3996
	$(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/serial_schedule $(EXTRA_TESTS)
7a3996
7a3996
installcheck-parallel: cleandirs
7a3996
	$(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(EXTRA_TESTS)
7a3996
7a3996
# The tests command the server to write into testtablespace and results.
7a3996
# On a SELinux-enabled system this will fail unless we mark those directories
7a3996
# as writable by the server.
7a3996
cleandirs:
7a3996
	-rm -rf testtablespace results
7a3996
	mkdir testtablespace results
7a3996
	if test -x /usr/bin/chcon && ! test -f /.dockerenv; then \
7a3996
	    /usr/bin/chcon -u system_u -r object_r -t postgresql_db_t testtablespace results ; \
7a3996
	fi
7a3996
7a3996
# old interfaces follow...
7a3996
7a3996
runcheck: check
7a3996
runtest: installcheck
7a3996
runtest-parallel: installcheck-parallel
7a3996
7a3996
7a3996
##
7a3996
## Clean up
7a3996
##
7a3996
7a3996
clean distclean maintainer-clean:
7a3996
	rm -f $(output_files) $(input_files)
7a3996
	rm -rf testtablespace
7a3996
	rm -rf results tmp_check log
7a3996
	rm -f regression.diffs regression.out regress.out run_check.out