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