1 #-------------------------------------------------------------------------
4 # Makefile for src/test/regress (the regression tests)
6 # Portions Copyright (c) 1996-2009, 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 # file with extra config for temp build
20 TEMP_CONF
+= --temp-config
=$(TEMP_CONFIG
)
23 # where to find psql for testing an existing installation
29 # maximum simultaneous connections for parallel tests
32 MAXCONNOPT
+= --max-connections
=$(MAX_CONNECTIONS
)
38 NOLOCALE
+= --no-locale
41 # stuff to pass into build of pg_regress
42 EXTRADEFS
= '-DHOST_TUPLE="$(host_tuple)"' \
43 '-DMAKEPROG="$(MAKE)"' \
44 '-DSHELLPROG="$(SHELL)"' \
45 '-DDLSUFFIX="$(DLSUFFIX)"'
51 # Build regression test driver
53 all: submake-libpgport pg_regress
$(X
)
55 pg_regress
$(X
): pg_regress.o pg_regress_main.o
56 $(CC
) $(CFLAGS
) $^
$(LDFLAGS
) $(LIBS
) -o
$@
58 # dependencies ensure that path changes propagate
59 pg_regress.o
: pg_regress.c
$(top_builddir
)/src
/port
/pg_config_paths.h
60 $(CC
) $(CFLAGS
) $(CPPFLAGS
) -I
$(top_builddir
)/src
/port
$(EXTRADEFS
) -c
-o
$@
$<
62 $(top_builddir
)/src
/port
/pg_config_paths.h
: $(top_builddir
)/src
/Makefile.global
63 $(MAKE
) -C
$(top_builddir
)/src
/port pg_config_paths.h
65 install: all installdirs
66 $(INSTALL_PROGRAM
) pg_regress
$(X
) '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
69 $(mkinstalldirs
) '$(DESTDIR)$(pgxsdir)/$(subdir)'
72 rm -f
'$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
75 # Build dynamically-loaded object file for CREATE FUNCTION ... LANGUAGE C.
80 include $(top_srcdir
)/src
/Makefile.shlib
84 # Test input and expected files. These are created by pg_regress itself, so we
85 # don't have a rule to create them. We do need rules to clean them however.
86 input_files
= $(patsubst $(srcdir)/input
/%.source
,sql
/%.sql
, $(wildcard $(srcdir)/input
/*.source
))
87 output_files
:= $(patsubst $(srcdir)/output
/%.source
,expected
/%.out
, $(wildcard $(srcdir)/output
/*.source
))
90 # not installed by default
92 regress_data_files
= \
93 $(filter-out $(addprefix $(srcdir)/,$(output_files
)),$(wildcard $(srcdir)/expected
/*.out
)) \
94 $(wildcard $(srcdir)/input
/*.source
) \
95 $(wildcard $(srcdir)/output
/*.source
) \
96 $(filter-out $(addprefix $(srcdir)/,$(input_files
)),$(wildcard $(srcdir)/sql
/*.sql
)) \
97 $(wildcard $(srcdir)/data
/*.data
) \
98 $(srcdir)/parallel_schedule
$(srcdir)/serial_schedule
$(srcdir)/resultmap
100 install-tests
: all install install-lib installdirs-tests
101 $(MAKE
) -C
$(top_builddir
)/contrib
/spi
install
102 for file in
$(regress_data_files
); do \
103 $(INSTALL_DATA
) $$file '$(DESTDIR)$(pkglibdir)/regress/'$$file; \
106 installdirs-tests
: installdirs
107 $(mkinstalldirs
) $(patsubst $(srcdir)/%/,'$(DESTDIR)$(pkglibdir)/regress/%',$(sort $(dir $(regress_data_files
))))
110 # Get some extra C modules from contrib/spi...
112 all: refint
$(DLSUFFIX
) autoinc
$(DLSUFFIX
)
114 refint
$(DLSUFFIX
): $(top_builddir
)/contrib
/spi
/refint
$(DLSUFFIX
)
117 autoinc
$(DLSUFFIX
): $(top_builddir
)/contrib
/spi
/autoinc
$(DLSUFFIX
)
120 $(top_builddir
)/contrib
/spi
/refint
$(DLSUFFIX
): $(top_srcdir
)/contrib
/spi
/refint.c
121 $(MAKE
) -C
$(top_builddir
)/contrib
/spi refint
$(DLSUFFIX
)
123 $(top_builddir
)/contrib
/spi
/autoinc
$(DLSUFFIX
): $(top_srcdir
)/contrib
/spi
/autoinc.c
124 $(MAKE
) -C
$(top_builddir
)/contrib
/spi autoinc
$(DLSUFFIX
)
129 all: tablespace-setup
131 .PHONY
: tablespace-setup
133 rm -rf .
/testtablespace
134 mkdir .
/testtablespace
141 pg_regress_call
= .
/pg_regress
--inputdir
=$(srcdir) --dlpath
=.
--multibyte
=$(MULTIBYTE
) --load-language
=plpgsql
$(NOLOCALE
)
144 $(pg_regress_call
) --temp-install
=.
/tmp_check
--top-builddir
=$(top_builddir
) --schedule
=$(srcdir)/parallel_schedule
$(MAXCONNOPT
) $(TEMP_CONF
)
147 $(pg_regress_call
) --psqldir
=$(PSQLDIR
) --schedule
=$(srcdir)/serial_schedule
149 installcheck-parallel
: all
150 $(pg_regress_call
) --psqldir
=$(PSQLDIR
) --schedule
=$(srcdir)/parallel_schedule
$(MAXCONNOPT
)
153 # old interfaces follow...
156 runtest
: installcheck
157 runtest-parallel
: installcheck-parallel
160 $(pg_regress_call
) --psqldir
=$(PSQLDIR
) --schedule
=$(srcdir)/serial_schedule numeric_big
163 $(pg_regress_call
) --temp-install
=.
/tmp_check
--top-builddir
=$(top_builddir
) --schedule
=$(srcdir)/parallel_schedule
$(MAXCONNOPT
) numeric_big
170 clean distclean maintainer-clean
: clean-lib
171 # things built by `all' target
172 rm -f
$(OBJS
) refint
$(DLSUFFIX
) autoinc
$(DLSUFFIX
) pg_regress_main.o pg_regress.o pg_regress
$(X
)
173 # things created by various check targets
174 rm -f
$(output_files
) $(input_files
)
175 rm -rf testtablespace
176 rm -rf results tmp_check log
177 rm -f regression.diffs regression.out regress.out run_check.out