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