1 #-------------------------------------------------------------------------
4 # Makefile for src/test/regress (the regression tests)
6 # Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
7 # Portions Copyright (c) 1994, Regents of the University of California
9 # src/test/regress/GNUmakefile
11 #-------------------------------------------------------------------------
13 PGFILEDESC
= "pg_regress - test driver"
16 subdir
= src
/test/regress
17 top_builddir
= ..
/..
/..
18 include $(top_builddir
)/src
/Makefile.global
20 # maximum simultaneous connections for parallel tests
23 MAXCONNOPT
+= --max-connections
=$(MAX_CONNECTIONS
)
26 # stuff to pass into build of pg_regress
27 EXTRADEFS
= '-DHOST_TUPLE="$(host_tuple)"' \
28 '-DSHELLPROG="$(SHELL)"' \
29 '-DDLSUFFIX="$(DLSUFFIX)"'
35 # Build regression test driver
39 pg_regress
$(X
): pg_regress.o pg_regress_main.o
$(WIN32RES
) | submake-libpgport
40 $(CC
) $(CFLAGS
) $^
$(LDFLAGS
) $(LDFLAGS_EX
) $(LIBS
) -o
$@
42 # dependencies ensure that path changes propagate
43 pg_regress.o
: pg_regress.c
$(top_builddir
)/src
/port
/pg_config_paths.h
44 pg_regress.o
: override CPPFLAGS
+= -I
$(top_builddir
)/src
/port
$(EXTRADEFS
)
46 # note: because of the submake dependency, this rule's action is really a no-op
47 $(top_builddir
)/src
/port
/pg_config_paths.h
: | submake-libpgport
48 $(MAKE
) -C
$(top_builddir
)/src
/port pg_config_paths.h
50 install: all installdirs
51 $(INSTALL_PROGRAM
) pg_regress
$(X
) '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
54 $(MKDIR_P
) '$(DESTDIR)$(pgxsdir)/$(subdir)'
57 rm -f
'$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
60 # Build dynamically-loaded object file for CREATE FUNCTION ... LANGUAGE C.
63 OBJS
= $(WIN32RES
) regress.o
65 include $(top_srcdir
)/src
/Makefile.shlib
69 # Ensure parallel safety if a build is started in this directory
70 $(OBJS
): | submake-libpgport submake-generated-headers
72 # Test input and expected files. These are created by pg_regress itself, so we
73 # don't have a rule to create them. We do need rules to clean them however.
74 input_files
= $(patsubst $(srcdir)/input
/%.source
,sql
/%.sql
, $(wildcard $(srcdir)/input
/*.source
))
75 output_files
:= $(patsubst $(srcdir)/output
/%.source
,expected
/%.out
, $(wildcard $(srcdir)/output
/*.source
))
78 # not installed by default
80 regress_data_files
= \
81 $(filter-out $(addprefix $(srcdir)/,$(output_files
)),$(wildcard $(srcdir)/expected
/*.out
)) \
82 $(wildcard $(srcdir)/input
/*.source
) \
83 $(wildcard $(srcdir)/output
/*.source
) \
84 $(filter-out $(addprefix $(srcdir)/,$(input_files
)),$(wildcard $(srcdir)/sql
/*.sql
)) \
85 $(wildcard $(srcdir)/data
/*.data
) \
86 $(srcdir)/parallel_schedule
$(srcdir)/resultmap
88 install-tests
: all install install-lib installdirs-tests
89 $(MAKE
) -C
$(top_builddir
)/contrib
/spi
install
90 for file in
$(subst $(srcdir)/,,$(regress_data_files
)); do \
91 $(INSTALL_DATA
) $(srcdir)/$$file '$(DESTDIR)$(pkglibdir)/regress/'$$file || exit
; \
94 installdirs-tests
: installdirs
95 $(MKDIR_P
) $(patsubst $(srcdir)/%/,'$(DESTDIR)$(pkglibdir)/regress/%',$(sort $(dir $(regress_data_files
))))
98 # Get some extra C modules from contrib/spi
100 all: refint
$(DLSUFFIX
) autoinc
$(DLSUFFIX
)
102 refint
$(DLSUFFIX
): $(top_builddir
)/contrib
/spi
/refint
$(DLSUFFIX
)
105 autoinc
$(DLSUFFIX
): $(top_builddir
)/contrib
/spi
/autoinc
$(DLSUFFIX
)
108 $(top_builddir
)/contrib
/spi
/refint
$(DLSUFFIX
): | submake-contrib-spi
;
110 $(top_builddir
)/contrib
/spi
/autoinc
$(DLSUFFIX
): | submake-contrib-spi
;
112 submake-contrib-spi
: | submake-libpgport submake-generated-headers
113 $(MAKE
) -C
$(top_builddir
)/contrib
/spi
115 .PHONY
: submake-contrib-spi
122 REGRESS_OPTS
= --dlpath
=.
--max-concurrent-tests
=20 --make-testtablespace-dir \
123 $(EXTRA_REGRESS_OPTS
)
126 $(pg_regress_check
) $(REGRESS_OPTS
) --schedule
=$(srcdir)/parallel_schedule
$(MAXCONNOPT
) $(EXTRA_TESTS
)
128 check-tests
: all | temp-install
129 $(pg_regress_check
) $(REGRESS_OPTS
) $(MAXCONNOPT
) $(TESTS
) $(EXTRA_TESTS
)
132 $(pg_regress_installcheck
) $(REGRESS_OPTS
) --schedule
=$(srcdir)/parallel_schedule
--max-connections
=1 $(EXTRA_TESTS
)
134 installcheck-parallel
: all
135 $(pg_regress_installcheck
) $(REGRESS_OPTS
) --schedule
=$(srcdir)/parallel_schedule
$(MAXCONNOPT
) $(EXTRA_TESTS
)
137 installcheck-tests
: all
138 $(pg_regress_installcheck
) $(REGRESS_OPTS
) $(TESTS
) $(EXTRA_TESTS
)
141 $(pg_regress_installcheck
) $(REGRESS_OPTS
) --schedule
=$(srcdir)/standby_schedule
--use-existing
143 # old interfaces follow...
146 runtest
: installcheck
147 runtest-parallel
: installcheck-parallel
150 $(pg_regress_installcheck
) $(REGRESS_OPTS
) --schedule
=$(srcdir)/parallel_schedule
--max-connections
=1 numeric_big
152 bigcheck
: all | temp-install
153 $(pg_regress_check
) $(REGRESS_OPTS
) --schedule
=$(srcdir)/parallel_schedule
$(MAXCONNOPT
) numeric_big
160 clean distclean maintainer-clean
: clean-lib
161 # things built by `all' target
162 rm -f
$(OBJS
) refint
$(DLSUFFIX
) autoinc
$(DLSUFFIX
)
163 rm -f pg_regress_main.o pg_regress.o pg_regress
$(X
)
164 # things created by various check targets
165 rm -f
$(output_files
) $(input_files
)
166 rm -rf testtablespace
167 rm -rf
$(pg_regress_clean_files
)