]> granicus.if.org Git - postgresql/blob - src/test/regress/GNUmakefile
Catch all errors in for and while loops in makefiles. Don't ignore any
[postgresql] / src / test / regress / GNUmakefile
1 #-------------------------------------------------------------------------
2 #
3 # GNUmakefile--
4 #    Makefile for src/test/regress (the regression tests)
5 #
6 # Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
7 # Portions Copyright (c) 1994, Regents of the University of California
8 #
9 # $PostgreSQL: pgsql/src/test/regress/GNUmakefile,v 1.72 2008/03/18 16:24:50 petere Exp $
10 #
11 #-------------------------------------------------------------------------
12
13 subdir = src/test/regress
14 top_builddir = ../../..
15 include $(top_builddir)/src/Makefile.global
16
17 contribdir = $(top_builddir)/contrib
18
19 # port number for temp-installation test postmaster
20 TEMP_PORT = 5$(DEF_PGPORT)
21
22 # file with extra config for temp build
23 TEMP_CONF =
24 ifdef TEMP_CONFIG
25 TEMP_CONF += --temp-config=$(TEMP_CONFIG)
26 endif
27
28 # where to find psql for testing an existing installation
29 PSQLDIR = $(bindir)
30
31 # default encoding
32 MULTIBYTE = SQL_ASCII
33
34 # maximum simultaneous connections for parallel tests
35 MAXCONNOPT =
36 ifdef MAX_CONNECTIONS
37 MAXCONNOPT += --max-connections=$(MAX_CONNECTIONS)
38 endif
39
40 # locale
41 NOLOCALE =
42 ifdef NO_LOCALE
43 NOLOCALE += --no-locale
44 endif
45
46 # stuff to pass into build of pg_regress
47 EXTRADEFS = '-DHOST_TUPLE="$(host_tuple)"' \
48         '-DMAKEPROG="$(MAKE)"' \
49         '-DSHELLPROG="$(SHELL)"' \
50         '-DDLSUFFIX="$(DLSUFFIX)"'
51
52 ##
53 ## Prepare for tests
54 ##
55
56 # Build regression test driver
57
58 all: submake-libpgport pg_regress$(X)
59
60 pg_regress$(X): pg_regress.o pg_regress_main.o
61         $(CC) $(CFLAGS) $^ $(LDFLAGS) $(LIBS) -o $@
62
63 # dependencies ensure that path changes propagate
64 pg_regress.o: pg_regress.c $(top_builddir)/src/port/pg_config_paths.h
65         $(CC) $(CFLAGS) $(CPPFLAGS) -I$(top_builddir)/src/port $(EXTRADEFS) -c -o $@ $<
66
67 $(top_builddir)/src/port/pg_config_paths.h: $(top_builddir)/src/Makefile.global
68         $(MAKE) -C $(top_builddir)/src/port pg_config_paths.h
69
70 install: pg_regress$(X)
71         $(INSTALL_PROGRAM) pg_regress$(X) '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
72
73 uninstall:
74         rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
75
76
77 # Build dynamically-loaded object file for CREATE FUNCTION ... LANGUAGE C.
78
79 NAME = regress
80 SO_MAJOR_VERSION= 0
81 SO_MINOR_VERSION= 0
82 OBJS = regress.o
83 SHLIB_LINK = $(BE_DLLLIBS)
84
85 include $(top_srcdir)/src/Makefile.shlib
86
87 all: $(NAME)$(DLSUFFIX)
88
89 $(NAME)$(DLSUFFIX): $(shlib)
90         rm -f $(NAME)$(DLSUFFIX)
91         $(LN_S) $(shlib) $(NAME)$(DLSUFFIX)
92
93 # Test input and expected files.  These are created by pg_regress itself, so we
94 # don't have a rule to create them.  We do need rules to clean them however.
95 ifile_list := $(subst .source,, $(notdir $(wildcard $(top_srcdir)/$(subdir)/input/*.source)))
96 input_files  := $(foreach file, $(ifile_list), sql/$(file).sql)
97 ofile_list := $(subst .source,, $(notdir $(wildcard $(top_srcdir)/$(subdir)/output/*.source)))
98 output_files := $(foreach file, $(ofile_list), expected/$(file).out)
99
100 ifneq ($(PORTNAME),win32)
101 abs_srcdir := $(shell cd $(srcdir) && pwd)
102 abs_builddir := $(shell pwd)
103 else
104 abs_srcdir := $(shell cd $(srcdir) && pwd -W)
105 abs_builddir := $(shell pwd -W)
106 endif
107
108 # When doing a VPATH build, copy over the remaining .sql and .out
109 # files so that the driver script can find them.  We have to use an
110 # absolute path for the targets, because otherwise make will try to
111 # locate the missing files using VPATH, and will find them in
112 # $(srcdir), but the point here is that we want to copy them from
113 # $(srcdir) to the build directory.
114
115 ifdef VPATH
116 remaining_files_src := $(wildcard $(srcdir)/sql/*.sql) $(wildcard $(srcdir)/expected/*.out) $(srcdir)/resultmap
117 remaining_files_build := $(patsubst $(srcdir)/%, $(abs_builddir)/%, $(remaining_files_src))
118
119 all: $(remaining_files_build)
120 $(remaining_files_build): $(abs_builddir)/%: $(srcdir)/%
121         ln -s $< $@
122 endif
123
124
125 # And finally some extra C modules...
126
127 all: all-spi tablespace-setup
128
129 .PHONY: all-spi
130 all-spi:
131         $(MAKE) -C $(contribdir)/spi refint$(DLSUFFIX) autoinc$(DLSUFFIX)
132
133 # Tablespace setup
134 .PHONY: tablespace-setup
135 tablespace-setup:
136         rm -rf ./testtablespace
137         mkdir ./testtablespace
138
139 ##
140 ## Run tests
141 ##
142
143 check: all
144         ./pg_regress --temp-install=./tmp_check --top-builddir=$(top_builddir) --srcdir=$(abs_srcdir) --temp-port=$(TEMP_PORT) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE) $(TEMP_CONF)
145
146 installcheck: all
147         ./pg_regress --psqldir=$(PSQLDIR) --schedule=$(srcdir)/serial_schedule --srcdir=$(abs_srcdir) --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE)
148
149 installcheck-parallel: all
150         ./pg_regress --psqldir=$(PSQLDIR) --schedule=$(srcdir)/parallel_schedule --srcdir=$(abs_srcdir) --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE)
151
152
153 # old interfaces follow...
154
155 runcheck: check
156 runtest: installcheck
157 runtest-parallel: installcheck-parallel
158
159 bigtest: all
160         ./pg_regress --psqldir=$(PSQLDIR) --schedule=$(srcdir)/serial_schedule --srcdir=$(abs_srcdir) --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE) numeric_big 
161
162 bigcheck: all
163         ./pg_regress --temp-install=./tmp_check --top-builddir=$(top_builddir) --srcdir=$(abs_srcdir) --temp-port=$(TEMP_PORT) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE) numeric_big
164
165
166 ##
167 ## Clean up
168 ##
169
170 clean distclean maintainer-clean: clean-lib
171 # things built by `all' target
172         rm -f $(NAME)$(DLSUFFIX) $(OBJS)
173         $(MAKE) -C $(contribdir)/spi clean
174         rm -f $(output_files) $(input_files) pg_regress_main.o pg_regress.o pg_regress$(X)
175 # things created by various check targets
176         rm -rf testtablespace
177         rm -rf results tmp_check log
178         rm -f regression.diffs regression.out regress.out run_check.out
179 ifeq ($(PORTNAME), cygwin)
180         rm -f regress.def
181 endif
182 ifdef VPATH
183         rm -f $(remaining_files_build)
184 endif