1 #-------------------------------------------------------------------------
4 # Makefile for src/test/regress (the regression tests)
6 # Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
7 # Portions Copyright (c) 1994, Regents of the University of California
9 # $PostgreSQL: pgsql/src/test/regress/GNUmakefile,v 1.65 2007/01/31 19:38:50 neilc 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)
22 # where to find psql for testing an existing installation
28 # maximum simultaneous connections for parallel tests
31 MAXCONNOPT += --max-connections=$(MAX_CONNECTIONS)
37 NOLOCALE += --no-locale
40 # stuff to pass into build of pg_regress
41 EXTRADEFS = '-DHOST_TUPLE="$(host_tuple)"' \
42 '-DMAKEPROG="$(MAKE)"' \
43 '-DSHELLPROG="$(SHELL)"' \
44 '-DDLSUFFIX="$(DLSUFFIX)"'
50 # Build regression test driver
52 all: submake-libpgport pg_regress$(X)
54 pg_regress$(X): pg_regress.o
55 $(CC) $(CFLAGS) $^ $(LDFLAGS) $(LIBS) -o $@
57 # dependencies ensure that path changes propagate
58 pg_regress.o: pg_regress.c $(top_builddir)/src/port/pg_config_paths.h
59 $(CC) $(CFLAGS) $(CPPFLAGS) -I$(top_builddir)/src/port $(EXTRADEFS) -c -o $@ $<
61 $(top_builddir)/src/port/pg_config_paths.h: $(top_builddir)/src/Makefile.global
62 $(MAKE) -C $(top_builddir)/src/port pg_config_paths.h
64 install: pg_regress$(X)
65 $(INSTALL_PROGRAM) pg_regress$(X) '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
68 rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
71 # Build dynamically-loaded object file for CREATE FUNCTION ... LANGUAGE C.
77 SHLIB_LINK = $(BE_DLLLIBS)
79 include $(top_srcdir)/src/Makefile.shlib
81 all: $(NAME)$(DLSUFFIX)
83 $(NAME)$(DLSUFFIX): $(shlib)
84 rm -f $(NAME)$(DLSUFFIX)
85 $(LN_S) $(shlib) $(NAME)$(DLSUFFIX)
87 # Test input and expected files. These are created by pg_regress itself, so we
88 # don't have a rule to create them. We do need rules to clean them however.
89 file_list := $(subst .source,, $(notdir $(wildcard $(top_srcdir)/$(subdir)/input/*.source)))
90 input_files := $(foreach file, $(file_list), sql/$(file).sql)
91 output_files := $(foreach file, $(file_list), expected/$(file).out)
93 ifneq ($(PORTNAME),win32)
94 abs_srcdir := $(shell cd $(srcdir) && pwd)
95 abs_builddir := $(shell pwd)
97 abs_srcdir := $(shell cd $(srcdir) && pwd -W)
98 abs_builddir := $(shell pwd -W)
101 # When doing a VPATH build, copy over the remaining .sql and .out
102 # files so that the driver script can find them. We have to use an
103 # absolute path for the targets, because otherwise make will try to
104 # locate the missing files using VPATH, and will find them in
105 # $(srcdir), but the point here is that we want to copy them from
106 # $(srcdir) to the build directory.
109 remaining_files_src := $(wildcard $(srcdir)/sql/*.sql) $(wildcard $(srcdir)/expected/*.out) $(srcdir)/resultmap
110 remaining_files_build := $(patsubst $(srcdir)/%, $(abs_builddir)/%, $(remaining_files_src))
112 all: $(remaining_files_build)
113 $(remaining_files_build): $(abs_builddir)/%: $(srcdir)/%
118 # And finally some extra C modules...
120 all: all-spi tablespace-setup
124 $(MAKE) -C $(contribdir)/spi refint$(DLSUFFIX) autoinc$(DLSUFFIX)
127 .PHONY: tablespace-setup
129 -rm -rf ./testtablespace
130 mkdir ./testtablespace
137 ./pg_regress --temp-install=./tmp_check --top-builddir=$(top_builddir) --srcdir=$(abs_srcdir) --temp-port=$(TEMP_PORT) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE)
140 ./pg_regress --psqldir=$(PSQLDIR) --schedule=$(srcdir)/serial_schedule --srcdir=$(abs_srcdir) --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE)
142 installcheck-parallel: all
143 ./pg_regress --psqldir=$(PSQLDIR) --schedule=$(srcdir)/parallel_schedule --srcdir=$(abs_srcdir) --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE)
146 # old interfaces follow...
149 runtest: installcheck
150 runtest-parallel: installcheck-parallel
153 ./pg_regress --psqldir=$(PSQLDIR) --schedule=$(srcdir)/serial_schedule --srcdir=$(abs_srcdir) --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE) numeric_big
156 ./pg_regress --temp-install=./tmp_check --top-builddir=$(top_builddir) --srcdir=$(abs_srcdir) --temp-port=$(TEMP_PORT) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE) numeric_big
163 clean distclean maintainer-clean: clean-lib
164 # things built by `all' target
165 rm -f $(NAME)$(DLSUFFIX) $(OBJS)
166 $(MAKE) -C $(contribdir)/spi clean
167 rm -f $(output_files) $(input_files) pg_regress.o pg_regress$(X)
168 # things created by various check targets
169 rm -rf testtablespace
170 rm -rf results tmp_check log
171 rm -f regression.diffs regression.out regress.out run_check.out
172 ifeq ($(PORTNAME), cygwin)
176 rm -f $(remaining_files_build)