1 #-------------------------------------------------------------------------
4 # Makefile for regress (the regression tests)
6 # Copyright (c) 1994, Regents of the University of California
10 # $PostgreSQL: pgsql/src/test/regress/GNUmakefile,v 1.49 2005/05/11 21:52:03 tgl Exp $
12 #-------------------------------------------------------------------------
14 subdir = src/test/regress
15 top_builddir = ../../..
16 include $(top_builddir)/src/Makefile.global
18 contribdir := $(top_builddir)/contrib
20 override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
21 override CFLAGS += $(CFLAGS_SL)
23 SHLIB_LINK = $(BE_DLLLIBS)
28 # maximum simultaneous connections for parallel tests
31 MAXCONNOPT += --max-connections=$(MAX_CONNECTIONS)
39 # Build regression test driver
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' \
57 # Build dynamically-loaded object file for CREATE FUNCTION ... LANGUAGE 'C'.
59 DLOBJS := regress$(DLSUFFIX)
60 # This is for some platforms
62 DLOBJS += regress$(EXPSUFF)
68 # Build test input and expected files
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)
74 all: $(input_files) $(output_files)
76 ifneq ($(PORTNAME),win32)
77 abs_srcdir := $(shell cd $(srcdir) && pwd)
78 abs_builddir := $(shell pwd)
80 abs_srcdir := $(shell cd $(srcdir) && pwd -W)
81 abs_builddir := $(shell pwd -W)
84 testtablespace := $(abs_builddir)/testtablespace
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' $< >$@
94 $(input_files): sql/%.sql: input/%.source
97 $(output_files): expected/%.out: output/%.source
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.
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))
111 all: $(remaining_files_build)
112 $(remaining_files_build): $(abs_builddir)/%: $(srcdir)/%
117 # And finally some extra C modules...
123 $(MAKE) -C $(contribdir)/spi refint$(DLSUFFIX) autoinc$(DLSUFFIX)
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)
136 -rm -rf ./testtablespace
137 mkdir ./testtablespace
138 $(SHELL) ./pg_regress --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql
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)
146 # old interfaces follow...
149 runtest: installcheck
150 runtest-parallel: installcheck-parallel
153 $(SHELL) ./pg_regress --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql numeric_big
156 $(SHELL) ./pg_regress --temp-install --top-builddir=$(top_builddir) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) numeric_big
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)
175 rm -f $(remaining_files_build)