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