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