]> granicus.if.org Git - postgresql/blob - src/test/regress/GNUmakefile
$Header: -> $PostgreSQL Changes ...
[postgresql] / src / test / regress / GNUmakefile
1 #-------------------------------------------------------------------------
2 #
3 # GNUmakefile--
4 #    Makefile for regress (the regression tests)
5 #
6 # Copyright (c) 1994, Regents of the University of California
7 #
8 #
9 # IDENTIFICATION
10 #    $PostgreSQL: pgsql/src/test/regress/GNUmakefile,v 1.44 2003/11/29 19:52:14 pgsql Exp $
11 #
12 #-------------------------------------------------------------------------
13
14 subdir = src/test/regress
15 top_builddir = ../../..
16 include $(top_builddir)/src/Makefile.global
17
18 contribdir := $(top_builddir)/contrib
19
20 override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
21 override CFLAGS += $(CFLAGS_SL)
22
23 SHLIB_LINK = $(BE_DLLLIBS)
24
25 # default encoding
26 MULTIBYTE = SQL_ASCII
27
28 # maximum simultaneous connections for parallel tests
29 MAXCONNOPT :=
30 ifdef MAX_CONNECTIONS
31 MAXCONNOPT += --max-connections=$(MAX_CONNECTIONS)
32 endif
33
34
35 ##
36 ## Prepare for tests
37 ##
38
39 # Build regression test driver
40
41 all: pg_regress
42
43 pg_regress: pg_regress.sh GNUmakefile
44         sed -e 's,@bindir@,$(bindir),g' \
45             -e 's,@libdir@,$(libdir),g' \
46             -e 's,@pkglibdir@,$(pkglibdir),g' \
47             -e 's,@datadir@,$(datadir),g' \
48             -e 's/@VERSION@/$(VERSION)/g' \
49             -e 's/@host_tuple@/$(host_tuple)/g' \
50             -e 's,@GMAKE@,$(MAKE),g' \
51             -e 's/@enable_shared@/$(enable_shared)/g' \
52             -e 's/@GCC@/$(GCC)/g' \
53           $< >$@
54         chmod a+x $@
55
56
57 # Build dynamically-loaded object file for CREATE FUNCTION ... LANGUAGE 'C'.
58
59 DLOBJS := regress$(DLSUFFIX)
60 # This is for some platforms
61 ifdef EXPSUFF
62 DLOBJS += regress$(EXPSUFF)
63 endif
64
65 all: $(DLOBJS)
66
67
68 # Build test input and expected files
69
70 file_list := copy create_function_1 create_function_2 misc constraints
71 input_files  := $(foreach file, $(file_list), sql/$(file).sql)
72 output_files := $(foreach file, $(file_list), expected/$(file).out)
73
74 all: $(input_files) $(output_files)
75
76 abs_srcdir := $(shell cd $(srcdir) && pwd)
77 abs_builddir := $(shell pwd)
78
79 define sed-command
80 sed -e 's,@abs_srcdir@,$(abs_srcdir),g' \
81     -e 's,@abs_builddir@,$(abs_builddir),g' \
82     -e 's/@DLSUFFIX@/$(DLSUFFIX)/g' $< >$@
83 endef
84
85 $(input_files): sql/%.sql: input/%.source
86         $(sed-command)
87
88 $(output_files): expected/%.out: output/%.source
89         $(sed-command)
90
91 # When doing a VPATH build, copy over the remaining .sql and .out
92 # files so that the driver script can find them.  We have to use an
93 # absolute path for the targets, because otherwise make will try to
94 # locate the missing files using VPATH, and will find them in
95 # $(srcdir), but the point here is that we want to copy them from
96 # $(srcdir) to the build directory.
97
98 ifdef VPATH
99 remaining_files_src := $(wildcard $(srcdir)/sql/*.sql) $(wildcard $(srcdir)/expected/*.out) $(srcdir)/resultmap
100 remaining_files_build := $(patsubst $(srcdir)/%, $(abs_builddir)/%, $(remaining_files_src))
101
102 all: $(remaining_files_build)
103 $(remaining_files_build): $(abs_builddir)/%: $(srcdir)/%
104         ln -s $< $@
105 endif
106
107
108 # And finally some extra C modules...
109
110 all: all-spi
111
112 .PHONY: all-spi
113 all-spi:
114         $(MAKE) -C $(contribdir)/spi refint$(DLSUFFIX) autoinc$(DLSUFFIX)
115
116
117 ##
118 ## Run tests
119 ##
120
121 check: all
122         $(SHELL) ./pg_regress --temp-install --top-builddir=$(top_builddir) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) $(MAXCONNOPT)
123
124 installcheck: all
125         $(SHELL) ./pg_regress --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE)
126
127
128 # old interfaces follow...
129
130 runcheck: check
131 runtest: installcheck
132
133 bigtest:
134         $(SHELL) ./pg_regress --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE) numeric_big
135
136 bigcheck:
137         $(SHELL) ./pg_regress --temp-install --top-builddir=$(top_builddir) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) $(MAXCONNOPT) numeric_big
138
139
140 ##
141 ## Clean up
142 ##
143
144 clean distclean maintainer-clean:
145 # things built by `all' target
146         $(MAKE) -C $(contribdir)/spi clean
147         rm -f $(output_files) $(input_files) $(DLOBJS) regress.o pg_regress
148 # things created by various check targets
149         rm -rf results tmp_check log
150         rm -f regression.diffs regression.out regress.out run_check.out
151 ifeq ($(PORTNAME), cygwin)
152         rm -f regress.def
153 endif
154 ifdef VPATH
155         rm -f $(remaining_files_build)
156 endif