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