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