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