1 #-------------------------------------------------------------------------
4 # Makefile for src/test/regress (the regression tests)
6 # Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group
7 # Portions Copyright (c) 1994, Regents of the University of California
9 # src/test/regress/GNUmakefile
11 #-------------------------------------------------------------------------
13 PGFILEDESC = "pg_regress - test driver"
16 subdir = src/test/regress
17 top_builddir = ../../..
18 include $(top_builddir)/src/Makefile.global
20 # file with extra config for temp build
23 TEMP_CONF += --temp-config=$(TEMP_CONFIG)
26 # where to find psql for testing an existing installation
29 # maximum simultaneous connections for parallel tests
32 MAXCONNOPT += --max-connections=$(MAX_CONNECTIONS)
35 # stuff to pass into build of pg_regress
36 EXTRADEFS = '-DHOST_TUPLE="$(host_tuple)"' \
37 '-DMAKEPROG="$(MAKE)"' \
38 '-DSHELLPROG="$(SHELL)"' \
39 '-DDLSUFFIX="$(DLSUFFIX)"'
45 # Build regression test driver
49 pg_regress$(X): pg_regress.o pg_regress_main.o $(WIN32RES) | submake-libpgport
50 $(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@
52 # dependencies ensure that path changes propagate
53 pg_regress.o: pg_regress.c $(top_builddir)/src/port/pg_config_paths.h
54 pg_regress.o: override CPPFLAGS += -I$(top_builddir)/src/port $(EXTRADEFS)
56 $(top_builddir)/src/port/pg_config_paths.h: $(top_builddir)/src/Makefile.global
57 $(MAKE) -C $(top_builddir)/src/port pg_config_paths.h
59 install: all installdirs
60 $(INSTALL_PROGRAM) pg_regress$(X) '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
63 $(MKDIR_P) '$(DESTDIR)$(pgxsdir)/$(subdir)'
66 rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
69 # Build dynamically-loaded object file for CREATE FUNCTION ... LANGUAGE C.
72 OBJS = $(WIN32RES) regress.o
74 include $(top_srcdir)/src/Makefile.shlib
78 # Test input and expected files. These are created by pg_regress itself, so we
79 # don't have a rule to create them. We do need rules to clean them however.
80 input_files = $(patsubst $(srcdir)/input/%.source,sql/%.sql, $(wildcard $(srcdir)/input/*.source))
81 output_files := $(patsubst $(srcdir)/output/%.source,expected/%.out, $(wildcard $(srcdir)/output/*.source))
84 # not installed by default
86 regress_data_files = \
87 $(filter-out $(addprefix $(srcdir)/,$(output_files)),$(wildcard $(srcdir)/expected/*.out)) \
88 $(wildcard $(srcdir)/input/*.source) \
89 $(wildcard $(srcdir)/output/*.source) \
90 $(filter-out $(addprefix $(srcdir)/,$(input_files)),$(wildcard $(srcdir)/sql/*.sql)) \
91 $(wildcard $(srcdir)/data/*.data) \
92 $(srcdir)/parallel_schedule $(srcdir)/serial_schedule $(srcdir)/resultmap
94 install-tests: all install install-lib installdirs-tests
95 $(MAKE) -C $(top_builddir)/contrib/spi install
96 for file in $(regress_data_files); do \
97 $(INSTALL_DATA) $$file '$(DESTDIR)$(pkglibdir)/regress/'$$file || exit; \
100 installdirs-tests: installdirs
101 $(MKDIR_P) $(patsubst $(srcdir)/%/,'$(DESTDIR)$(pkglibdir)/regress/%',$(sort $(dir $(regress_data_files))))
104 # Get some extra C modules from contrib/spi
106 all: refint$(DLSUFFIX) autoinc$(DLSUFFIX)
108 refint$(DLSUFFIX): $(top_builddir)/contrib/spi/refint$(DLSUFFIX)
111 autoinc$(DLSUFFIX): $(top_builddir)/contrib/spi/autoinc$(DLSUFFIX)
114 $(top_builddir)/contrib/spi/refint$(DLSUFFIX): | submake-contrib-spi ;
116 $(top_builddir)/contrib/spi/autoinc$(DLSUFFIX): | submake-contrib-spi ;
119 $(MAKE) -C $(top_builddir)/contrib/spi
121 .PHONY: submake-contrib-spi
125 .PHONY: tablespace-setup
127 rm -rf ./testtablespace
128 mkdir ./testtablespace
135 REGRESS_OPTS = --dlpath=. $(EXTRA_REGRESS_OPTS)
137 check: all tablespace-setup
138 $(pg_regress_check) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(TEMP_CONF) $(EXTRA_TESTS)
140 check-tests: all tablespace-setup
141 $(pg_regress_check) $(REGRESS_OPTS) $(MAXCONNOPT) $(TEMP_CONF) $(TESTS) $(EXTRA_TESTS)
143 installcheck: all tablespace-setup
144 $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/serial_schedule $(EXTRA_TESTS)
146 installcheck-parallel: all tablespace-setup
147 $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(EXTRA_TESTS)
149 installcheck-tests: all tablespace-setup
150 $(pg_regress_installcheck) $(REGRESS_OPTS) $(TESTS) $(EXTRA_TESTS)
153 $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/standby_schedule --use-existing
155 # old interfaces follow...
158 runtest: installcheck
159 runtest-parallel: installcheck-parallel
161 bigtest: all tablespace-setup
162 $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/serial_schedule numeric_big
164 bigcheck: all tablespace-setup
165 $(pg_regress_check) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) numeric_big
172 clean distclean maintainer-clean: clean-lib
173 # things built by `all' target
174 rm -f $(OBJS) refint$(DLSUFFIX) autoinc$(DLSUFFIX)
175 rm -f pg_regress_main.o pg_regress.o pg_regress$(X)
176 # things created by various check targets
177 rm -f $(output_files) $(input_files)
178 rm -rf testtablespace
179 rm -rf $(pg_regress_clean_files)