1 #-------------------------------------------------------------------------
4 # Makefile for src/test/regress (the regression tests)
6 # Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
7 # Portions Copyright (c) 1994, Regents of the University of California
11 #-------------------------------------------------------------------------
13 subdir
= src
/test/regress
14 top_builddir
= ..
/..
/..
15 include $(top_builddir
)/src
/Makefile.global
17 # port number for temp-installation test postmaster
18 TEMP_PORT
= 5$(DEF_PGPORT
)
20 # file with extra config for temp build
23 TEMP_CONF
+= --temp-config
=$(TEMP_CONFIG
)
26 # where to find psql for testing an existing installation
32 # maximum simultaneous connections for parallel tests
35 MAXCONNOPT
+= --max-connections
=$(MAX_CONNECTIONS
)
41 NOLOCALE
+= --no-locale
44 # stuff to pass into build of pg_regress
45 EXTRADEFS
= '-DHOST_TUPLE="$(host_tuple)"' \
46 '-DMAKEPROG="$(MAKE)"' \
47 '-DSHELLPROG="$(SHELL)"' \
48 '-DDLSUFFIX="$(DLSUFFIX)"'
54 # Build regression test driver
56 all: submake-libpgport pg_regress
$(X
)
58 pg_regress
$(X
): pg_regress.o pg_regress_main.o
59 $(CC
) $(CFLAGS
) $^
$(LDFLAGS
) $(LIBS
) -o
$@
61 # dependencies ensure that path changes propagate
62 pg_regress.o
: pg_regress.c
$(top_builddir
)/src
/port
/pg_config_paths.h
63 $(CC
) $(CFLAGS
) $(CPPFLAGS
) -I
$(top_builddir
)/src
/port
$(EXTRADEFS
) -c
-o
$@
$<
65 $(top_builddir
)/src
/port
/pg_config_paths.h
: $(top_builddir
)/src
/Makefile.global
66 $(MAKE
) -C
$(top_builddir
)/src
/port pg_config_paths.h
68 install: all installdirs
69 $(INSTALL_PROGRAM
) pg_regress
$(X
) '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
72 $(mkinstalldirs
) '$(DESTDIR)$(pgxsdir)/$(subdir)'
75 rm -f
'$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
78 # Build dynamically-loaded object file for CREATE FUNCTION ... LANGUAGE C.
83 include $(top_srcdir
)/src
/Makefile.shlib
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 input_files
= $(patsubst $(srcdir)/input
/%.source
,sql
/%.sql
, $(wildcard $(srcdir)/input
/*.source
))
90 output_files
:= $(patsubst $(srcdir)/output
/%.source
,expected
/%.out
, $(wildcard $(srcdir)/output
/*.source
))
93 # not installed by default
95 regress_data_files
= \
96 $(filter-out $(addprefix $(srcdir)/,$(output_files
)),$(wildcard $(srcdir)/expected
/*.out
)) \
97 $(wildcard $(srcdir)/input
/*.source
) \
98 $(wildcard $(srcdir)/output
/*.source
) \
99 $(filter-out $(addprefix $(srcdir)/,$(input_files
)),$(wildcard $(srcdir)/sql
/*.sql
)) \
100 $(wildcard $(srcdir)/data
/*.data
) \
101 $(srcdir)/parallel_schedule
$(srcdir)/serial_schedule
$(srcdir)/resultmap
103 install-tests
: all install install-lib installdirs-tests
104 $(MAKE
) -C
$(top_builddir
)/contrib
/spi
install
105 for file in
$(regress_data_files
); do \
106 $(INSTALL_DATA
) $$file '$(DESTDIR)$(pkglibdir)/regress/'$$file; \
109 installdirs-tests
: installdirs
110 $(mkinstalldirs
) $(patsubst $(srcdir)/%/,'$(DESTDIR)$(pkglibdir)/regress/%',$(sort $(dir $(regress_data_files
))))
113 # Get some extra C modules from contrib/spi...
115 all: refint
$(DLSUFFIX
) autoinc
$(DLSUFFIX
)
117 refint
$(DLSUFFIX
): $(top_builddir
)/contrib
/spi
/refint
$(DLSUFFIX
)
120 autoinc
$(DLSUFFIX
): $(top_builddir
)/contrib
/spi
/autoinc
$(DLSUFFIX
)
123 $(top_builddir
)/contrib
/spi
/refint
$(DLSUFFIX
): $(top_srcdir
)/contrib
/spi
/refint.c
124 $(MAKE
) -C
$(top_builddir
)/contrib
/spi refint
$(DLSUFFIX
)
126 $(top_builddir
)/contrib
/spi
/autoinc
$(DLSUFFIX
): $(top_srcdir
)/contrib
/spi
/autoinc.c
127 $(MAKE
) -C
$(top_builddir
)/contrib
/spi autoinc
$(DLSUFFIX
)
132 all: tablespace-setup
134 .PHONY
: tablespace-setup
136 rm -rf .
/testtablespace
137 mkdir .
/testtablespace
144 pg_regress_call
= .
/pg_regress
--inputdir
=$(srcdir) --dlpath
=.
--multibyte
=$(MULTIBYTE
) --load-language
=plpgsql
$(NOLOCALE
)
147 $(pg_regress_call
) --temp-install
=.
/tmp_check
--top-builddir
=$(top_builddir
) --temp-port
=$(TEMP_PORT
) --schedule
=$(srcdir)/parallel_schedule
$(MAXCONNOPT
) $(TEMP_CONF
)
150 $(pg_regress_call
) --psqldir
=$(PSQLDIR
) --schedule
=$(srcdir)/serial_schedule
152 installcheck-parallel
: all
153 $(pg_regress_call
) --psqldir
=$(PSQLDIR
) --schedule
=$(srcdir)/parallel_schedule
$(MAXCONNOPT
)
156 # old interfaces follow...
159 runtest
: installcheck
160 runtest-parallel
: installcheck-parallel
163 $(pg_regress_call
) --psqldir
=$(PSQLDIR
) --schedule
=$(srcdir)/serial_schedule numeric_big
166 $(pg_regress_call
) --temp-install
=.
/tmp_check
--top-builddir
=$(top_builddir
) --temp-port
=$(TEMP_PORT
) --schedule
=$(srcdir)/parallel_schedule
$(MAXCONNOPT
) numeric_big
173 clean distclean maintainer-clean
: clean-lib
174 # things built by `all' target
175 rm -f
$(OBJS
) refint
$(DLSUFFIX
) autoinc
$(DLSUFFIX
) pg_regress_main.o pg_regress.o pg_regress
$(X
)
176 # things created by various check targets
177 rm -f
$(output_files
) $(input_files
)
178 rm -rf testtablespace
179 rm -rf results tmp_check log
180 rm -f regression.diffs regression.out regress.out run_check.out