]> granicus.if.org Git - postgresql/blob - src/test/regress/GNUmakefile
Move test modules from contrib to src/test/modules
[postgresql] / src / test / regress / GNUmakefile
1 #-------------------------------------------------------------------------
2 #
3 # GNUmakefile--
4 #    Makefile for src/test/regress (the regression tests)
5 #
6 # Portions Copyright (c) 1996-2014, 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 # file with extra config for temp build
21 TEMP_CONF =
22 ifdef TEMP_CONFIG
23 TEMP_CONF += --temp-config=$(TEMP_CONFIG)
24 endif
25
26 # where to find psql for testing an existing installation
27 PSQLDIR = $(bindir)
28
29 # maximum simultaneous connections for parallel tests
30 MAXCONNOPT =
31 ifdef MAX_CONNECTIONS
32 MAXCONNOPT += --max-connections=$(MAX_CONNECTIONS)
33 endif
34
35 # stuff to pass into build of pg_regress
36 EXTRADEFS = '-DHOST_TUPLE="$(host_tuple)"' \
37         '-DMAKEPROG="$(MAKE)"' \
38         '-DSHELLPROG="$(SHELL)"' \
39         '-DDLSUFFIX="$(DLSUFFIX)"'
40
41 ##
42 ## Prepare for tests
43 ##
44
45 # Build regression test driver
46
47 all: pg_regress$(X)
48
49 pg_regress$(X): pg_regress.o pg_regress_main.o $(WIN32RES) | submake-libpgport
50         $(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@
51
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)
55
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
58
59 install: all installdirs
60         $(INSTALL_PROGRAM) pg_regress$(X) '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
61
62 installdirs:
63         $(MKDIR_P) '$(DESTDIR)$(pgxsdir)/$(subdir)'
64
65 uninstall:
66         rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
67
68
69 # Build dynamically-loaded object file for CREATE FUNCTION ... LANGUAGE C.
70
71 NAME = regress
72 OBJS = $(WIN32RES) regress.o
73
74 include $(top_srcdir)/src/Makefile.shlib
75
76 all: all-lib
77
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))
82
83
84 # not installed by default
85
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
93
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; \
98         done
99
100 installdirs-tests: installdirs
101         $(MKDIR_P)  $(patsubst $(srcdir)/%/,'$(DESTDIR)$(pkglibdir)/regress/%',$(sort $(dir $(regress_data_files))))
102
103
104 # Get some extra C modules from contrib/spi and src/test/modules/dummy_seclabel...
105
106 all: refint$(DLSUFFIX) autoinc$(DLSUFFIX) dummy_seclabel$(DLSUFFIX)
107
108 refint$(DLSUFFIX): $(top_builddir)/contrib/spi/refint$(DLSUFFIX)
109         cp $< $@
110
111 autoinc$(DLSUFFIX): $(top_builddir)/contrib/spi/autoinc$(DLSUFFIX)
112         cp $< $@
113
114 dummy_seclabel$(DLSUFFIX): $(top_builddir)/src/test/modules/dummy_seclabel/dummy_seclabel$(DLSUFFIX)
115         cp $< $@
116
117 $(top_builddir)/contrib/spi/refint$(DLSUFFIX): | submake-contrib-spi ;
118
119 $(top_builddir)/contrib/spi/autoinc$(DLSUFFIX): | submake-contrib-spi ;
120
121 $(top_builddir)/src/test/modules/dummy_seclabel/dummy_seclabel$(DLSUFFIX): | submake-dummy_seclabel ;
122
123 submake-contrib-spi:
124         $(MAKE) -C $(top_builddir)/contrib/spi
125
126 submake-dummy_seclabel:
127         $(MAKE) -C $(top_builddir)/src/test/modules/dummy_seclabel
128
129 .PHONY: submake-contrib-spi submake-dummy_seclabel
130
131 # Tablespace setup
132
133 .PHONY: tablespace-setup
134 tablespace-setup:
135         rm -rf ./testtablespace
136         mkdir ./testtablespace
137
138
139 ##
140 ## Run tests
141 ##
142
143 REGRESS_OPTS = --dlpath=. $(EXTRA_REGRESS_OPTS)
144
145 check: all tablespace-setup
146         $(pg_regress_check) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(TEMP_CONF) $(EXTRA_TESTS)
147
148 check-tests: all tablespace-setup
149         $(pg_regress_check) $(REGRESS_OPTS) $(MAXCONNOPT) $(TEMP_CONF) $(TESTS) $(EXTRA_TESTS)
150
151 installcheck: all tablespace-setup
152         $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/serial_schedule $(EXTRA_TESTS)
153
154 installcheck-parallel: all tablespace-setup
155         $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(EXTRA_TESTS)
156
157 installcheck-tests: all tablespace-setup
158         $(pg_regress_installcheck) $(REGRESS_OPTS) $(TESTS) $(EXTRA_TESTS)
159
160 standbycheck: all
161         $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/standby_schedule --use-existing
162
163 # old interfaces follow...
164
165 runcheck: check
166 runtest: installcheck
167 runtest-parallel: installcheck-parallel
168
169 bigtest: all tablespace-setup
170         $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/serial_schedule numeric_big
171
172 bigcheck: all tablespace-setup
173         $(pg_regress_check) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) numeric_big
174
175
176 ##
177 ## Clean up
178 ##
179
180 clean distclean maintainer-clean: clean-lib
181 # things built by `all' target
182         rm -f $(OBJS) refint$(DLSUFFIX) autoinc$(DLSUFFIX) dummy_seclabel$(DLSUFFIX)
183         rm -f pg_regress_main.o pg_regress.o pg_regress$(X)
184 # things created by various check targets
185         rm -f $(output_files) $(input_files)
186         rm -rf testtablespace
187         rm -rf $(pg_regress_clean_files)