1 #-------------------------------------------------------------------------
4 # Makefile for src/test/regress (the regression tests)
6 # Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
7 # Portions Copyright (c) 1994, Regents of the University of California
9 # $PostgreSQL: pgsql/src/test/regress/GNUmakefile,v 1.58 2006/07/19 02:37:00 tgl 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
37 # stuff to pass into build of pg_regress
38 EXTRADEFS = '-DPGBINDIR="$(bindir)"' \
39 '-DLIBDIR="$(libdir)"' \
40 '-DPGSHAREDIR="$(datadir)"' \
41 '-DHOST_TUPLE="$(host_tuple)"' \
42 '-DMAKEPROG="$(MAKE)"'
48 # Build regression test driver
50 all: submake-libpgport pg_regress$(X)
52 pg_regress$(X): pg_regress.o
53 $(CC) $(CFLAGS) $^ $(libpq_pgport) $(LDFLAGS) $(LIBS) -o $@
55 # depend on Makefile.global to ensure that symbol changes propagate
56 pg_regress.o: pg_regress.c $(top_builddir)/src/Makefile.global
57 $(CC) $(CFLAGS) $(CPPFLAGS) $(EXTRADEFS) -c -o $@ $<
59 install: pg_regress$(X)
60 $(INSTALL_PROGRAM) pg_regress$(X) '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
63 rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
66 # Build dynamically-loaded object file for CREATE FUNCTION ... LANGUAGE C.
72 SHLIB_LINK = $(BE_DLLLIBS)
74 include $(top_srcdir)/src/Makefile.shlib
76 all: $(NAME)$(DLSUFFIX)
78 $(NAME)$(DLSUFFIX): $(shlib)
79 rm -f $(NAME)$(DLSUFFIX)
80 $(LN_S) $(shlib) $(NAME)$(DLSUFFIX)
82 # Build test input and expected files
84 file_list := copy create_function_1 create_function_2 misc constraints tablespace
85 input_files := $(foreach file, $(file_list), sql/$(file).sql)
86 output_files := $(foreach file, $(file_list), expected/$(file).out)
88 all: $(input_files) $(output_files)
90 ifneq ($(PORTNAME),win32)
91 abs_srcdir := $(shell cd $(srcdir) && pwd)
92 abs_builddir := $(shell pwd)
94 abs_srcdir := $(shell cd $(srcdir) && pwd -W)
95 abs_builddir := $(shell pwd -W)
98 testtablespace := $(abs_builddir)/testtablespace
102 sed -e 's,@abs_srcdir@,$(abs_srcdir),g' \
103 -e 's,@abs_builddir@,$(abs_builddir),g' \
104 -e 's,@testtablespace@,$(testtablespace),g' \
105 -e 's/@DLSUFFIX@/$(DLSUFFIX)/g' $< >$@
108 $(input_files): sql/%.sql: input/%.source
111 $(output_files): expected/%.out: output/%.source
114 # When doing a VPATH build, copy over the remaining .sql and .out
115 # files so that the driver script can find them. We have to use an
116 # absolute path for the targets, because otherwise make will try to
117 # locate the missing files using VPATH, and will find them in
118 # $(srcdir), but the point here is that we want to copy them from
119 # $(srcdir) to the build directory.
122 remaining_files_src := $(wildcard $(srcdir)/sql/*.sql) $(wildcard $(srcdir)/expected/*.out) $(srcdir)/resultmap
123 remaining_files_build := $(patsubst $(srcdir)/%, $(abs_builddir)/%, $(remaining_files_src))
125 all: $(remaining_files_build)
126 $(remaining_files_build): $(abs_builddir)/%: $(srcdir)/%
131 # And finally some extra C modules...
137 $(MAKE) -C $(contribdir)/spi refint$(DLSUFFIX) autoinc$(DLSUFFIX)
145 -rm -rf ./testtablespace
146 mkdir ./testtablespace
147 ./pg_regress --temp-install=./tmp_check --top-builddir=$(top_builddir) --temp-port=$(TEMP_PORT) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE)
150 -rm -rf ./testtablespace
151 mkdir ./testtablespace
152 ./pg_regress --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE)
154 installcheck-parallel: all
155 -rm -rf ./testtablespace
156 mkdir ./testtablespace
157 ./pg_regress --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE)
160 # old interfaces follow...
163 runtest: installcheck
164 runtest-parallel: installcheck-parallel
167 ./pg_regress --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE) numeric_big
170 ./pg_regress --temp-install=./tmp_check --top-builddir=$(top_builddir) --temp-port=$(TEMP_PORT) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE) numeric_big
177 clean distclean maintainer-clean: clean-lib
178 # things built by `all' target
179 rm -f $(NAME)$(DLSUFFIX) $(OBJS)
180 $(MAKE) -C $(contribdir)/spi clean
181 rm -f $(output_files) $(input_files) pg_regress.o pg_regress$(X)
182 # things created by various check targets
183 rm -rf testtablespace
184 rm -rf results tmp_check log
185 rm -f regression.diffs regression.out regress.out run_check.out
186 ifeq ($(PORTNAME), cygwin)
190 rm -f $(remaining_files_build)