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.61 2006/07/20 01:16:57 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 = '-DHOST_TUPLE="$(host_tuple)"' \
39 '-DMAKEPROG="$(MAKE)"' \
40 '-DSHELLPROG="$(SHELL)"'
46 # Build regression test driver
48 all: submake-libpgport pg_regress$(X)
50 pg_regress$(X): pg_regress.o
51 $(CC) $(CFLAGS) $^ $(LDFLAGS) $(LIBS) -o $@
53 # dependencies ensure that path changes propagate
54 pg_regress.o: pg_regress.c $(top_builddir)/src/port/pg_config_paths.h
55 $(CC) $(CFLAGS) $(CPPFLAGS) -I$(top_builddir)/src/port $(EXTRADEFS) -c -o $@ $<
57 $(top_builddir)/src/port/pg_config_paths.h: $(top_builddir)/src/Makefile.global
58 $(MAKE) -C $(top_builddir)/src/port pg_config_paths.h
60 install: pg_regress$(X)
61 $(INSTALL_PROGRAM) pg_regress$(X) '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
64 rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
67 # Build dynamically-loaded object file for CREATE FUNCTION ... LANGUAGE C.
73 SHLIB_LINK = $(BE_DLLLIBS)
75 include $(top_srcdir)/src/Makefile.shlib
77 all: $(NAME)$(DLSUFFIX)
79 $(NAME)$(DLSUFFIX): $(shlib)
80 rm -f $(NAME)$(DLSUFFIX)
81 $(LN_S) $(shlib) $(NAME)$(DLSUFFIX)
83 # Build test input and expected files
85 file_list := copy create_function_1 create_function_2 misc constraints tablespace
86 input_files := $(foreach file, $(file_list), sql/$(file).sql)
87 output_files := $(foreach file, $(file_list), expected/$(file).out)
89 all: $(input_files) $(output_files)
91 ifneq ($(PORTNAME),win32)
92 abs_srcdir := $(shell cd $(srcdir) && pwd)
93 abs_builddir := $(shell pwd)
95 abs_srcdir := $(shell cd $(srcdir) && pwd -W)
96 abs_builddir := $(shell pwd -W)
99 testtablespace := $(abs_builddir)/testtablespace
103 sed -e 's,@abs_srcdir@,$(abs_srcdir),g' \
104 -e 's,@abs_builddir@,$(abs_builddir),g' \
105 -e 's,@testtablespace@,$(testtablespace),g' \
106 -e 's/@DLSUFFIX@/$(DLSUFFIX)/g' $< >$@
109 $(input_files): sql/%.sql: input/%.source
112 $(output_files): expected/%.out: output/%.source
115 # When doing a VPATH build, copy over the remaining .sql and .out
116 # files so that the driver script can find them. We have to use an
117 # absolute path for the targets, because otherwise make will try to
118 # locate the missing files using VPATH, and will find them in
119 # $(srcdir), but the point here is that we want to copy them from
120 # $(srcdir) to the build directory.
123 remaining_files_src := $(wildcard $(srcdir)/sql/*.sql) $(wildcard $(srcdir)/expected/*.out) $(srcdir)/resultmap
124 remaining_files_build := $(patsubst $(srcdir)/%, $(abs_builddir)/%, $(remaining_files_src))
126 all: $(remaining_files_build)
127 $(remaining_files_build): $(abs_builddir)/%: $(srcdir)/%
132 # And finally some extra C modules...
138 $(MAKE) -C $(contribdir)/spi refint$(DLSUFFIX) autoinc$(DLSUFFIX)
146 -rm -rf ./testtablespace
147 mkdir ./testtablespace
148 ./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)
151 -rm -rf ./testtablespace
152 mkdir ./testtablespace
153 ./pg_regress --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE)
155 installcheck-parallel: all
156 -rm -rf ./testtablespace
157 mkdir ./testtablespace
158 ./pg_regress --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE)
161 # old interfaces follow...
164 runtest: installcheck
165 runtest-parallel: installcheck-parallel
168 ./pg_regress --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE) numeric_big
171 ./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
178 clean distclean maintainer-clean: clean-lib
179 # things built by `all' target
180 rm -f $(NAME)$(DLSUFFIX) $(OBJS)
181 $(MAKE) -C $(contribdir)/spi clean
182 rm -f $(output_files) $(input_files) pg_regress.o pg_regress$(X)
183 # things created by various check targets
184 rm -rf testtablespace
185 rm -rf results tmp_check log
186 rm -f regression.diffs regression.out regress.out run_check.out
187 ifeq ($(PORTNAME), cygwin)
191 rm -f $(remaining_files_build)