1 #-------------------------------------------------------------------------
4 # Makefile for src/test/regress (the regression tests)
6 # Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
7 # Portions Copyright (c) 1994, Regents of the University of California
9 # $PostgreSQL: pgsql/src/test/regress/GNUmakefile,v 1.56 2006/02/27 16:09:50 petere Exp $
11 #-------------------------------------------------------------------------
13 subdir = src/test/regress
14 top_builddir = ../../..
15 include $(top_builddir)/src/Makefile.global
17 contribdir := $(top_builddir)/contrib
19 # port number for temp-installation test postmaster
20 TEMP_PORT = 5$(DEF_PGPORT)
25 # maximum simultaneous connections for parallel tests
28 MAXCONNOPT += --max-connections=$(MAX_CONNECTIONS)
34 NOLOCALE += --no-locale
41 # Build regression test driver
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' \
59 $(INSTALL_SCRIPT) pg_regress '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress'
62 rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress'
65 # Build dynamically-loaded object file for CREATE FUNCTION ... LANGUAGE C.
71 SHLIB_LINK = $(BE_DLLLIBS)
73 include $(top_srcdir)/src/Makefile.shlib
75 all: $(NAME)$(DLSUFFIX)
77 $(NAME)$(DLSUFFIX): $(shlib)
78 rm -f $(NAME)$(DLSUFFIX)
79 $(LN_S) $(shlib) $(NAME)$(DLSUFFIX)
81 # Build test input and expected files
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)
87 all: $(input_files) $(output_files)
89 ifneq ($(PORTNAME),win32)
90 abs_srcdir := $(shell cd $(srcdir) && pwd)
91 abs_builddir := $(shell pwd)
93 abs_srcdir := $(shell cd $(srcdir) && pwd -W)
94 abs_builddir := $(shell pwd -W)
97 testtablespace := $(abs_builddir)/testtablespace
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' $< >$@
107 $(input_files): sql/%.sql: input/%.source
110 $(output_files): expected/%.out: output/%.source
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.
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))
124 all: $(remaining_files_build)
125 $(remaining_files_build): $(abs_builddir)/%: $(srcdir)/%
130 # And finally some extra C modules...
136 $(MAKE) -C $(contribdir)/spi refint$(DLSUFFIX) autoinc$(DLSUFFIX)
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)
149 -rm -rf ./testtablespace
150 mkdir ./testtablespace
151 $(SHELL) ./pg_regress --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE)
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)
159 # old interfaces follow...
162 runtest: installcheck
163 runtest-parallel: installcheck-parallel
166 $(SHELL) ./pg_regress --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE) numeric_big
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
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)
189 rm -f $(remaining_files_build)