]> granicus.if.org Git - postgresql/blob - src/test/regress/GNUmakefile
Update copyright for 2006. Update scripts.
[postgresql] / src / test / regress / GNUmakefile
1 #-------------------------------------------------------------------------
2 #
3 # GNUmakefile--
4 #    Makefile for src/test/regress (the regression tests)
5 #
6 # Portions Copyright (c) 1996-2006, 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.57 2006/03/05 15:59:11 momjian 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 # default encoding
23 MULTIBYTE = SQL_ASCII
24
25 # maximum simultaneous connections for parallel tests
26 MAXCONNOPT :=
27 ifdef MAX_CONNECTIONS
28 MAXCONNOPT += --max-connections=$(MAX_CONNECTIONS)
29 endif
30
31 # locale
32 NOLOCALE :=
33 ifdef NO_LOCALE
34 NOLOCALE += --no-locale
35 endif
36
37 ##
38 ## Prepare for tests
39 ##
40
41 # Build regression test driver
42
43 all: pg_regress
44
45 pg_regress: pg_regress.sh GNUmakefile $(top_builddir)/src/Makefile.global
46         sed -e 's,@bindir@,$(bindir),g' \
47             -e 's,@libdir@,$(libdir),g' \
48             -e 's,@pkglibdir@,$(pkglibdir),g' \
49             -e 's,@datadir@,$(datadir),g' \
50             -e 's/@VERSION@/$(VERSION)/g' \
51             -e 's/@host_tuple@/$(host_tuple)/g' \
52             -e 's,@GMAKE@,$(MAKE),g' \
53             -e 's/@enable_shared@/$(enable_shared)/g' \
54             -e 's/@GCC@/$(GCC)/g' \
55           $< >$@
56         chmod a+x $@
57
58 install: pg_regress
59         $(INSTALL_SCRIPT) pg_regress '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress'
60
61 uninstall:
62         rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress'
63
64
65 # Build dynamically-loaded object file for CREATE FUNCTION ... LANGUAGE C.
66
67 NAME = regress
68 SO_MAJOR_VERSION= 0
69 SO_MINOR_VERSION= 0
70 OBJS = regress.o
71 SHLIB_LINK = $(BE_DLLLIBS)
72
73 include $(top_srcdir)/src/Makefile.shlib
74
75 all: $(NAME)$(DLSUFFIX)
76
77 $(NAME)$(DLSUFFIX): $(shlib)
78         rm -f $(NAME)$(DLSUFFIX)
79         $(LN_S) $(shlib) $(NAME)$(DLSUFFIX)
80
81 # Build test input and expected files
82
83 file_list := copy create_function_1 create_function_2 misc constraints tablespace
84 input_files  := $(foreach file, $(file_list), sql/$(file).sql)
85 output_files := $(foreach file, $(file_list), expected/$(file).out)
86
87 all: $(input_files) $(output_files)
88
89 ifneq ($(PORTNAME),win32)
90 abs_srcdir := $(shell cd $(srcdir) && pwd)
91 abs_builddir := $(shell pwd)
92 else
93 abs_srcdir := $(shell cd $(srcdir) && pwd -W)
94 abs_builddir := $(shell pwd -W)
95 endif
96
97 testtablespace := $(abs_builddir)/testtablespace
98
99
100 define sed-command
101 sed -e 's,@abs_srcdir@,$(abs_srcdir),g' \
102     -e 's,@abs_builddir@,$(abs_builddir),g' \
103     -e 's,@testtablespace@,$(testtablespace),g' \
104     -e 's/@DLSUFFIX@/$(DLSUFFIX)/g' $< >$@
105 endef
106
107 $(input_files): sql/%.sql: input/%.source
108         $(sed-command)
109
110 $(output_files): expected/%.out: output/%.source
111         $(sed-command)
112
113 # When doing a VPATH build, copy over the remaining .sql and .out
114 # files so that the driver script can find them.  We have to use an
115 # absolute path for the targets, because otherwise make will try to
116 # locate the missing files using VPATH, and will find them in
117 # $(srcdir), but the point here is that we want to copy them from
118 # $(srcdir) to the build directory.
119
120 ifdef VPATH
121 remaining_files_src := $(wildcard $(srcdir)/sql/*.sql) $(wildcard $(srcdir)/expected/*.out) $(srcdir)/resultmap
122 remaining_files_build := $(patsubst $(srcdir)/%, $(abs_builddir)/%, $(remaining_files_src))
123
124 all: $(remaining_files_build)
125 $(remaining_files_build): $(abs_builddir)/%: $(srcdir)/%
126         ln -s $< $@
127 endif
128
129
130 # And finally some extra C modules...
131
132 all: all-spi
133
134 .PHONY: all-spi
135 all-spi:
136         $(MAKE) -C $(contribdir)/spi refint$(DLSUFFIX) autoinc$(DLSUFFIX)
137
138
139 ##
140 ## Run tests
141 ##
142
143 check: all
144         -rm -rf ./testtablespace
145         mkdir ./testtablespace
146         $(SHELL) ./pg_regress --temp-install --top-builddir=$(top_builddir) --temp-port=$(TEMP_PORT) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE)
147
148 installcheck: all
149         -rm -rf ./testtablespace
150         mkdir ./testtablespace
151         $(SHELL) ./pg_regress --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE)
152
153 installcheck-parallel: all
154         -rm -rf ./testtablespace
155         mkdir ./testtablespace
156         $(SHELL) ./pg_regress --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE)
157
158
159 # old interfaces follow...
160
161 runcheck: check
162 runtest: installcheck
163 runtest-parallel: installcheck-parallel
164
165 bigtest:
166         $(SHELL) ./pg_regress --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE) numeric_big 
167
168 bigcheck:
169         $(SHELL) ./pg_regress --temp-install --top-builddir=$(top_builddir) --temp-port=$(TEMP_PORT) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE) numeric_big
170
171
172 ##
173 ## Clean up
174 ##
175
176 clean distclean maintainer-clean: clean-lib
177 # things built by `all' target
178         rm -f $(NAME)$(DLSUFFIX) $(OBJS)
179         $(MAKE) -C $(contribdir)/spi clean
180         rm -f $(output_files) $(input_files) pg_regress
181 # things created by various check targets
182         rm -rf testtablespace
183         rm -rf results tmp_check log
184         rm -f regression.diffs regression.out regress.out run_check.out
185 ifeq ($(PORTNAME), cygwin)
186         rm -f regress.def
187 endif
188 ifdef VPATH
189         rm -f $(remaining_files_build)
190 endif