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