]> granicus.if.org Git - postgresql/blob - src/test/regress/GNUmakefile
Respect TEMP_CONFIG when pg_regress_check and friends are called
[postgresql] / src / test / regress / GNUmakefile
1 #-------------------------------------------------------------------------
2 #
3 # GNUmakefile--
4 #    Makefile for src/test/regress (the regression tests)
5 #
6 # Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
7 # Portions Copyright (c) 1994, Regents of the University of California
8 #
9 # src/test/regress/GNUmakefile
10 #
11 #-------------------------------------------------------------------------
12
13 PGFILEDESC = "pg_regress - test driver"
14 PGAPPICON = win32
15
16 subdir = src/test/regress
17 top_builddir = ../../..
18 include $(top_builddir)/src/Makefile.global
19
20 # maximum simultaneous connections for parallel tests
21 MAXCONNOPT =
22 ifdef MAX_CONNECTIONS
23 MAXCONNOPT += --max-connections=$(MAX_CONNECTIONS)
24 endif
25
26 # stuff to pass into build of pg_regress
27 EXTRADEFS = '-DHOST_TUPLE="$(host_tuple)"' \
28         '-DSHELLPROG="$(SHELL)"' \
29         '-DDLSUFFIX="$(DLSUFFIX)"'
30
31 ##
32 ## Prepare for tests
33 ##
34
35 # Build regression test driver
36
37 all: pg_regress$(X)
38
39 pg_regress$(X): pg_regress.o pg_regress_main.o $(WIN32RES) | submake-libpgport
40         $(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@
41
42 # dependencies ensure that path changes propagate
43 pg_regress.o: pg_regress.c $(top_builddir)/src/port/pg_config_paths.h
44 pg_regress.o: override CPPFLAGS += -I$(top_builddir)/src/port $(EXTRADEFS)
45
46 $(top_builddir)/src/port/pg_config_paths.h: $(top_builddir)/src/Makefile.global
47         $(MAKE) -C $(top_builddir)/src/port pg_config_paths.h
48
49 install: all installdirs
50         $(INSTALL_PROGRAM) pg_regress$(X) '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
51
52 installdirs:
53         $(MKDIR_P) '$(DESTDIR)$(pgxsdir)/$(subdir)'
54
55 uninstall:
56         rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
57
58
59 # Build dynamically-loaded object file for CREATE FUNCTION ... LANGUAGE C.
60
61 NAME = regress
62 OBJS = $(WIN32RES) regress.o
63
64 include $(top_srcdir)/src/Makefile.shlib
65
66 all: all-lib
67
68 # Test input and expected files.  These are created by pg_regress itself, so we
69 # don't have a rule to create them.  We do need rules to clean them however.
70 input_files = $(patsubst $(srcdir)/input/%.source,sql/%.sql, $(wildcard $(srcdir)/input/*.source))
71 output_files := $(patsubst $(srcdir)/output/%.source,expected/%.out, $(wildcard $(srcdir)/output/*.source))
72
73
74 # not installed by default
75
76 regress_data_files = \
77         $(filter-out $(addprefix $(srcdir)/,$(output_files)),$(wildcard $(srcdir)/expected/*.out)) \
78         $(wildcard $(srcdir)/input/*.source) \
79         $(wildcard $(srcdir)/output/*.source) \
80         $(filter-out $(addprefix $(srcdir)/,$(input_files)),$(wildcard $(srcdir)/sql/*.sql)) \
81         $(wildcard $(srcdir)/data/*.data) \
82         $(srcdir)/parallel_schedule $(srcdir)/serial_schedule $(srcdir)/resultmap
83
84 install-tests: all install install-lib installdirs-tests
85         $(MAKE) -C $(top_builddir)/contrib/spi install
86         for file in $(regress_data_files); do \
87           $(INSTALL_DATA) $$file '$(DESTDIR)$(pkglibdir)/regress/'$$file || exit; \
88         done
89
90 installdirs-tests: installdirs
91         $(MKDIR_P)  $(patsubst $(srcdir)/%/,'$(DESTDIR)$(pkglibdir)/regress/%',$(sort $(dir $(regress_data_files))))
92
93
94 # Get some extra C modules from contrib/spi
95
96 all: refint$(DLSUFFIX) autoinc$(DLSUFFIX)
97
98 refint$(DLSUFFIX): $(top_builddir)/contrib/spi/refint$(DLSUFFIX)
99         cp $< $@
100
101 autoinc$(DLSUFFIX): $(top_builddir)/contrib/spi/autoinc$(DLSUFFIX)
102         cp $< $@
103
104 $(top_builddir)/contrib/spi/refint$(DLSUFFIX): | submake-contrib-spi ;
105
106 $(top_builddir)/contrib/spi/autoinc$(DLSUFFIX): | submake-contrib-spi ;
107
108 submake-contrib-spi:
109         $(MAKE) -C $(top_builddir)/contrib/spi
110
111 .PHONY: submake-contrib-spi
112
113 # Tablespace setup
114
115 .PHONY: tablespace-setup
116 tablespace-setup:
117         rm -rf ./testtablespace
118         mkdir ./testtablespace
119
120
121 ##
122 ## Run tests
123 ##
124
125 REGRESS_OPTS = --dlpath=. $(EXTRA_REGRESS_OPTS)
126
127 check: all tablespace-setup
128         $(pg_regress_check) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(EXTRA_TESTS)
129
130 check-tests: all tablespace-setup
131         $(pg_regress_check) $(REGRESS_OPTS) $(MAXCONNOPT) $(TESTS) $(EXTRA_TESTS)
132
133 installcheck: all tablespace-setup
134         $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/serial_schedule $(EXTRA_TESTS)
135
136 installcheck-parallel: all tablespace-setup
137         $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(EXTRA_TESTS)
138
139 installcheck-tests: all tablespace-setup
140         $(pg_regress_installcheck) $(REGRESS_OPTS) $(TESTS) $(EXTRA_TESTS)
141
142 standbycheck: all
143         $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/standby_schedule --use-existing
144
145 # old interfaces follow...
146
147 runcheck: check
148 runtest: installcheck
149 runtest-parallel: installcheck-parallel
150
151 bigtest: all tablespace-setup
152         $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/serial_schedule numeric_big
153
154 bigcheck: all tablespace-setup
155         $(pg_regress_check) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) numeric_big
156
157
158 ##
159 ## Clean up
160 ##
161
162 clean distclean maintainer-clean: clean-lib
163 # things built by `all' target
164         rm -f $(OBJS) refint$(DLSUFFIX) autoinc$(DLSUFFIX)
165         rm -f pg_regress_main.o pg_regress.o pg_regress$(X)
166 # things created by various check targets
167         rm -f $(output_files) $(input_files)
168         rm -rf testtablespace
169         rm -rf $(pg_regress_clean_files)