GNUmakefile 5.03 KB
Newer Older
1 2
#-------------------------------------------------------------------------
#
3
# GNUmakefile--
4
#    Makefile for src/test/regress (the regression tests)
5
#
6 7
# Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
8
#
9
# $PostgreSQL: pgsql/src/test/regress/GNUmakefile,v 1.53 2005/11/01 15:09:11 adunstan Exp $
10 11 12
#
#-------------------------------------------------------------------------

13 14 15
subdir = src/test/regress
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
16

17
contribdir := $(top_builddir)/contrib
18

19 20 21
# port number for temp-installation test postmaster
TEMP_PORT = 5$(DEF_PGPORT)

22 23 24
# default encoding
MULTIBYTE = SQL_ASCII

25 26 27 28 29 30
# maximum simultaneous connections for parallel tests
MAXCONNOPT :=
ifdef MAX_CONNECTIONS
MAXCONNOPT += --max-connections=$(MAX_CONNECTIONS)
endif

31 32 33 34 35
# locale
NOLOCALE :=
ifdef NO_LOCALE
NOLOCALE += --no-locale
endif
36

37 38 39 40 41 42 43 44
##
## Prepare for tests
##

# Build regression test driver

all: pg_regress

45
pg_regress: pg_regress.sh GNUmakefile $(top_builddir)/src/Makefile.global
46 47
	sed -e 's,@bindir@,$(bindir),g' \
	    -e 's,@libdir@,$(libdir),g' \
48
	    -e 's,@pkglibdir@,$(pkglibdir),g' \
49 50 51
	    -e 's,@datadir@,$(datadir),g' \
	    -e 's/@VERSION@/$(VERSION)/g' \
	    -e 's/@host_tuple@/$(host_tuple)/g' \
52
	    -e 's,@GMAKE@,$(MAKE),g' \
53
	    -e 's/@enable_shared@/$(enable_shared)/g' \
54
	    -e 's/@GCC@/$(GCC)/g' \
55 56 57 58 59 60
	  $< >$@
	chmod a+x $@


# Build dynamically-loaded object file for CREATE FUNCTION ... LANGUAGE 'C'.

61 62 63
NAME = regress
SO_MAJOR_VERSION= 0
SO_MINOR_VERSION= 0
64
OBJS = regress.o
65 66 67 68 69 70 71 72 73 74
SHLIB_LINK = $(BE_DLLLIBS)

include $(top_srcdir)/src/Makefile.shlib

all: $(NAME)$(DLSUFFIX)

$(NAME)$(DLSUFFIX): $(shlib)
	rm -f $(NAME)$(DLSUFFIX)
	$(LN_S) $(shlib) $(NAME)$(DLSUFFIX)

75 76
# Build test input and expected files

77
file_list := copy create_function_1 create_function_2 misc constraints tablespace
78 79 80 81 82
input_files  := $(foreach file, $(file_list), sql/$(file).sql)
output_files := $(foreach file, $(file_list), expected/$(file).out)

all: $(input_files) $(output_files)

83
ifneq ($(PORTNAME),win32)
84 85
abs_srcdir := $(shell cd $(srcdir) && pwd)
abs_builddir := $(shell pwd)
86 87 88 89 90
else
abs_srcdir := $(shell cd $(srcdir) && pwd -W)
abs_builddir := $(shell pwd -W)
endif

91 92
testtablespace := $(abs_builddir)/testtablespace

93

94 95 96
define sed-command
sed -e 's,@abs_srcdir@,$(abs_srcdir),g' \
    -e 's,@abs_builddir@,$(abs_builddir),g' \
97
    -e 's,@testtablespace@,$(testtablespace),g' \
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
    -e 's/@DLSUFFIX@/$(DLSUFFIX)/g' $< >$@
endef

$(input_files): sql/%.sql: input/%.source
	$(sed-command)

$(output_files): expected/%.out: output/%.source
	$(sed-command)

# When doing a VPATH build, copy over the remaining .sql and .out
# files so that the driver script can find them.  We have to use an
# absolute path for the targets, because otherwise make will try to
# locate the missing files using VPATH, and will find them in
# $(srcdir), but the point here is that we want to copy them from
# $(srcdir) to the build directory.

ifdef VPATH
115
remaining_files_src := $(wildcard $(srcdir)/sql/*.sql) $(wildcard $(srcdir)/expected/*.out) $(srcdir)/resultmap
116 117 118 119 120 121
remaining_files_build := $(patsubst $(srcdir)/%, $(abs_builddir)/%, $(remaining_files_src))

all: $(remaining_files_build)
$(remaining_files_build): $(abs_builddir)/%: $(srcdir)/%
	ln -s $< $@
endif
122 123 124 125 126 127 128 129


# And finally some extra C modules...

all: all-spi

.PHONY: all-spi
all-spi:
130
	$(MAKE) -C $(contribdir)/spi refint$(DLSUFFIX) autoinc$(DLSUFFIX)
131 132 133 134 135 136 137


##
## Run tests
##

check: all
138 139
	-rm -rf ./testtablespace
	mkdir ./testtablespace
140
	$(SHELL) ./pg_regress --temp-install --top-builddir=$(top_builddir) --temp-port=$(TEMP_PORT) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE)
141 142

installcheck: all
143 144
	-rm -rf ./testtablespace
	mkdir ./testtablespace
145
	$(SHELL) ./pg_regress --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE)
146

147 148 149
installcheck-parallel: all
	-rm -rf ./testtablespace
	mkdir ./testtablespace
150
	$(SHELL) ./pg_regress --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE)
151

152 153 154

# old interfaces follow...

155 156
runcheck: check
runtest: installcheck
157
runtest-parallel: installcheck-parallel
158

159
bigtest:
160
	$(SHELL) ./pg_regress --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE) numeric_big 
161

162
bigcheck:
163
	$(SHELL) ./pg_regress --temp-install --top-builddir=$(top_builddir) --temp-port=$(TEMP_PORT) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE) numeric_big
164

165

166 167 168
##
## Clean up
##
169

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
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)
180 181
	rm -f regress.def
endif
182 183 184
ifdef VPATH
	rm -f $(remaining_files_build)
endif