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.70 2007/09/09 22:53:33 adunstan 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 # file with extra config for temp build
25 TEMP_CONF += --temp-config=$(TEMP_CONFIG)
28 # where to find psql for testing an existing installation
34 # maximum simultaneous connections for parallel tests
37 MAXCONNOPT += --max-connections=$(MAX_CONNECTIONS)
43 NOLOCALE += --no-locale
46 # stuff to pass into build of pg_regress
47 EXTRADEFS = '-DHOST_TUPLE="$(host_tuple)"' \
48 '-DMAKEPROG="$(MAKE)"' \
49 '-DSHELLPROG="$(SHELL)"' \
50 '-DDLSUFFIX="$(DLSUFFIX)"'
56 # Build regression test driver
58 all: submake-libpgport pg_regress$(X)
60 pg_regress$(X): pg_regress.o pg_regress_main.o
61 $(CC) $(CFLAGS) $^ $(LDFLAGS) $(LIBS) -o $@
63 # dependencies ensure that path changes propagate
64 pg_regress.o: pg_regress.c $(top_builddir)/src/port/pg_config_paths.h
65 $(CC) $(CFLAGS) $(CPPFLAGS) -I$(top_builddir)/src/port $(EXTRADEFS) -c -o $@ $<
67 $(top_builddir)/src/port/pg_config_paths.h: $(top_builddir)/src/Makefile.global
68 $(MAKE) -C $(top_builddir)/src/port pg_config_paths.h
70 install: pg_regress$(X)
71 $(INSTALL_PROGRAM) pg_regress$(X) '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
74 rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
77 # Build dynamically-loaded object file for CREATE FUNCTION ... LANGUAGE C.
83 SHLIB_LINK = $(BE_DLLLIBS)
85 include $(top_srcdir)/src/Makefile.shlib
87 all: $(NAME)$(DLSUFFIX)
89 $(NAME)$(DLSUFFIX): $(shlib)
90 rm -f $(NAME)$(DLSUFFIX)
91 $(LN_S) $(shlib) $(NAME)$(DLSUFFIX)
93 # Test input and expected files. These are created by pg_regress itself, so we
94 # don't have a rule to create them. We do need rules to clean them however.
95 ifile_list := $(subst .source,, $(notdir $(wildcard $(top_srcdir)/$(subdir)/input/*.source)))
96 input_files := $(foreach file, $(ifile_list), sql/$(file).sql)
97 ofile_list := $(subst .source,, $(notdir $(wildcard $(top_srcdir)/$(subdir)/output/*.source)))
98 output_files := $(foreach file, $(ofile_list), expected/$(file).out)
100 ifneq ($(PORTNAME),win32)
101 abs_srcdir := $(shell cd $(srcdir) && pwd)
102 abs_builddir := $(shell pwd)
104 abs_srcdir := $(shell cd $(srcdir) && pwd -W)
105 abs_builddir := $(shell pwd -W)
108 # When doing a VPATH build, copy over the remaining .sql and .out
109 # files so that the driver script can find them. We have to use an
110 # absolute path for the targets, because otherwise make will try to
111 # locate the missing files using VPATH, and will find them in
112 # $(srcdir), but the point here is that we want to copy them from
113 # $(srcdir) to the build directory.
116 remaining_files_src := $(wildcard $(srcdir)/sql/*.sql) $(wildcard $(srcdir)/expected/*.out) $(srcdir)/resultmap
117 remaining_files_build := $(patsubst $(srcdir)/%, $(abs_builddir)/%, $(remaining_files_src))
119 all: $(remaining_files_build)
120 $(remaining_files_build): $(abs_builddir)/%: $(srcdir)/%
125 # And finally some extra C modules...
127 all: all-spi tablespace-setup
131 $(MAKE) -C $(contribdir)/spi refint$(DLSUFFIX) autoinc$(DLSUFFIX)
134 .PHONY: tablespace-setup
136 -rm -rf ./testtablespace
137 mkdir ./testtablespace
144 ./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) $(TEMP_CONF)
147 ./pg_regress --psqldir=$(PSQLDIR) --schedule=$(srcdir)/serial_schedule --srcdir=$(abs_srcdir) --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE)
149 installcheck-parallel: all
150 ./pg_regress --psqldir=$(PSQLDIR) --schedule=$(srcdir)/parallel_schedule --srcdir=$(abs_srcdir) --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE)
153 # old interfaces follow...
156 runtest: installcheck
157 runtest-parallel: installcheck-parallel
160 ./pg_regress --psqldir=$(PSQLDIR) --schedule=$(srcdir)/serial_schedule --srcdir=$(abs_srcdir) --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE) numeric_big
163 ./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
170 clean distclean maintainer-clean: clean-lib
171 # things built by `all' target
172 rm -f $(NAME)$(DLSUFFIX) $(OBJS)
173 $(MAKE) -C $(contribdir)/spi clean
174 rm -f $(output_files) $(input_files) pg_regress_main.o pg_regress.o pg_regress$(X)
175 # things created by various check targets
176 rm -rf testtablespace
177 rm -rf results tmp_check log
178 rm -f regression.diffs regression.out regress.out run_check.out
179 ifeq ($(PORTNAME), cygwin)
183 rm -f $(remaining_files_build)