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