]> granicus.if.org Git - postgresql/blob - src/test/regress/GNUmakefile
ICU support
[postgresql] / src / test / regress / GNUmakefile
1 #-------------------------------------------------------------------------
2 #
3 # GNUmakefile--
4 #    Makefile for src/test/regress (the regression tests)
5 #
6 # Portions Copyright (c) 1996-2017, 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 $(OBJS): | submake-generated-headers
69
70 # Test input and expected files.  These are created by pg_regress itself, so we
71 # don't have a rule to create them.  We do need rules to clean them however.
72 input_files = $(patsubst $(srcdir)/input/%.source,sql/%.sql, $(wildcard $(srcdir)/input/*.source))
73 output_files := $(patsubst $(srcdir)/output/%.source,expected/%.out, $(wildcard $(srcdir)/output/*.source))
74
75
76 # not installed by default
77
78 regress_data_files = \
79         $(filter-out $(addprefix $(srcdir)/,$(output_files)),$(wildcard $(srcdir)/expected/*.out)) \
80         $(wildcard $(srcdir)/input/*.source) \
81         $(wildcard $(srcdir)/output/*.source) \
82         $(filter-out $(addprefix $(srcdir)/,$(input_files)),$(wildcard $(srcdir)/sql/*.sql)) \
83         $(wildcard $(srcdir)/data/*.data) \
84         $(srcdir)/parallel_schedule $(srcdir)/serial_schedule $(srcdir)/resultmap
85
86 install-tests: all install install-lib installdirs-tests
87         $(MAKE) -C $(top_builddir)/contrib/spi install
88         for file in $(regress_data_files); do \
89           $(INSTALL_DATA) $$file '$(DESTDIR)$(pkglibdir)/regress/'$$file || exit; \
90         done
91
92 installdirs-tests: installdirs
93         $(MKDIR_P)  $(patsubst $(srcdir)/%/,'$(DESTDIR)$(pkglibdir)/regress/%',$(sort $(dir $(regress_data_files))))
94
95
96 # Get some extra C modules from contrib/spi
97
98 all: refint$(DLSUFFIX) autoinc$(DLSUFFIX)
99
100 refint$(DLSUFFIX): $(top_builddir)/contrib/spi/refint$(DLSUFFIX)
101         cp $< $@
102
103 autoinc$(DLSUFFIX): $(top_builddir)/contrib/spi/autoinc$(DLSUFFIX)
104         cp $< $@
105
106 $(top_builddir)/contrib/spi/refint$(DLSUFFIX): | submake-contrib-spi ;
107
108 $(top_builddir)/contrib/spi/autoinc$(DLSUFFIX): | submake-contrib-spi ;
109
110 submake-contrib-spi: | submake-libpgport submake-generated-headers
111         $(MAKE) -C $(top_builddir)/contrib/spi
112
113 .PHONY: submake-contrib-spi
114
115 # Tablespace setup
116
117 .PHONY: tablespace-setup
118 tablespace-setup:
119         rm -rf ./testtablespace
120         mkdir ./testtablespace
121
122
123 ##
124 ## Run tests
125 ##
126
127 REGRESS_OPTS = --dlpath=. $(EXTRA_REGRESS_OPTS)
128 ifeq ($(with_icu),yes)
129 override EXTRA_TESTS := collate.icu $(EXTRA_TESTS)
130 endif
131
132 check: all tablespace-setup
133         $(pg_regress_check) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(EXTRA_TESTS)
134
135 check-tests: all tablespace-setup
136         $(pg_regress_check) $(REGRESS_OPTS) $(MAXCONNOPT) $(TESTS) $(EXTRA_TESTS)
137
138 installcheck: all tablespace-setup
139         $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/serial_schedule $(EXTRA_TESTS)
140
141 installcheck-parallel: all tablespace-setup
142         $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(EXTRA_TESTS)
143
144 installcheck-tests: all tablespace-setup
145         $(pg_regress_installcheck) $(REGRESS_OPTS) $(TESTS) $(EXTRA_TESTS)
146
147 standbycheck: all
148         $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/standby_schedule --use-existing
149
150 # old interfaces follow...
151
152 runcheck: check
153 runtest: installcheck
154 runtest-parallel: installcheck-parallel
155
156 bigtest: all tablespace-setup
157         $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/serial_schedule numeric_big
158
159 bigcheck: all tablespace-setup
160         $(pg_regress_check) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) numeric_big
161
162
163 ##
164 ## Clean up
165 ##
166
167 clean distclean maintainer-clean: clean-lib
168 # things built by `all' target
169         rm -f $(OBJS) refint$(DLSUFFIX) autoinc$(DLSUFFIX)
170         rm -f pg_regress_main.o pg_regress.o pg_regress$(X)
171 # things created by various check targets
172         rm -f $(output_files) $(input_files)
173         rm -rf testtablespace
174         rm -rf $(pg_regress_clean_files)