1 #-------------------------------------------------------------------------
4 # Makefile for src/test/regress (the regression tests)
6 # Portions Copyright (c) 1996-2024, 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)"'
34 # Build regression test driver
38 pg_regress
$(X
): pg_regress.o pg_regress_main.o
$(WIN32RES
) | submake-libpgport
39 $(CC
) $(CFLAGS
) $^
$(libpq_pgport
) $(LDFLAGS
) $(LDFLAGS_EX
) $(LIBS
) -o
$@
41 # dependencies ensure that path changes propagate
42 pg_regress.o
: pg_regress.c
$(top_builddir
)/src
/port
/pg_config_paths.h
43 pg_regress.o
: override CPPFLAGS
+= -I
$(top_builddir
)/src
/port
-I
$(libpq_srcdir
) $(EXTRADEFS
)
45 # note: because of the submake dependency, this rule's action is really a no-op
46 $(top_builddir
)/src
/port
/pg_config_paths.h
: | submake-libpgport
47 $(MAKE
) -C
$(top_builddir
)/src
/port pg_config_paths.h
49 install: all installdirs
50 $(INSTALL_PROGRAM
) pg_regress
$(X
) '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
53 $(MKDIR_P
) '$(DESTDIR)$(pgxsdir)/$(subdir)'
56 rm -f
'$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
59 # Build dynamically-loaded object file for CREATE FUNCTION ... LANGUAGE C.
62 OBJS
= $(WIN32RES
) regress.o
64 include $(top_srcdir
)/src
/Makefile.shlib
68 # Ensure parallel safety if a build is started in this directory
69 $(OBJS
): | submake-libpgport submake-generated-headers
72 # not installed by default
74 regress_data_files
= \
75 $(wildcard $(srcdir)/sql
/*.sql
) \
76 $(wildcard $(srcdir)/expected
/*.out
) \
77 $(wildcard $(srcdir)/data
/*.data
) \
78 $(srcdir)/parallel_schedule
$(srcdir)/resultmap
80 install-tests
: all install install-lib installdirs-tests
81 $(MAKE
) -C
$(top_builddir
)/contrib
/spi
install
82 for file in
$(subst $(srcdir)/,,$(regress_data_files
)); do \
83 $(INSTALL_DATA
) $(srcdir)/$$file '$(DESTDIR)$(pkglibdir)/regress/'$$file || exit
; \
86 installdirs-tests
: installdirs
87 $(MKDIR_P
) $(patsubst $(srcdir)/%/,'$(DESTDIR)$(pkglibdir)/regress/%',$(sort $(dir $(regress_data_files
))))
90 # Get some extra C modules from contrib/spi
92 all: refint
$(DLSUFFIX
) autoinc
$(DLSUFFIX
)
94 refint
$(DLSUFFIX
): $(top_builddir
)/contrib
/spi
/refint
$(DLSUFFIX
)
97 autoinc
$(DLSUFFIX
): $(top_builddir
)/contrib
/spi
/autoinc
$(DLSUFFIX
)
100 $(top_builddir
)/contrib
/spi
/refint
$(DLSUFFIX
): | submake-contrib-spi
;
102 $(top_builddir
)/contrib
/spi
/autoinc
$(DLSUFFIX
): | submake-contrib-spi
;
104 submake-contrib-spi
: | submake-libpgport submake-generated-headers
105 $(MAKE
) -C
$(top_builddir
)/contrib
/spi
107 .PHONY
: submake-contrib-spi
114 REGRESS_OPTS
= --dlpath
=.
--max-concurrent-tests
=20 \
115 $(EXTRA_REGRESS_OPTS
)
118 $(pg_regress_check
) $(REGRESS_OPTS
) --schedule
=$(srcdir)/parallel_schedule
$(MAXCONNOPT
) $(EXTRA_TESTS
)
120 check-tests
: all | temp-install
121 $(pg_regress_check
) $(REGRESS_OPTS
) $(MAXCONNOPT
) $(TESTS
) $(EXTRA_TESTS
)
124 $(pg_regress_installcheck
) $(REGRESS_OPTS
) --schedule
=$(srcdir)/parallel_schedule
--max-connections
=1 $(EXTRA_TESTS
)
126 installcheck-parallel
: all
127 $(pg_regress_installcheck
) $(REGRESS_OPTS
) --schedule
=$(srcdir)/parallel_schedule
$(MAXCONNOPT
) $(EXTRA_TESTS
)
129 installcheck-tests
: all
130 $(pg_regress_installcheck
) $(REGRESS_OPTS
) $(TESTS
) $(EXTRA_TESTS
)
132 # old interfaces follow...
135 runtest
: installcheck
136 runtest-parallel
: installcheck-parallel
139 $(pg_regress_installcheck
) $(REGRESS_OPTS
) --schedule
=$(srcdir)/parallel_schedule
--max-connections
=1 numeric_big
141 bigcheck
: all | temp-install
142 $(pg_regress_check
) $(REGRESS_OPTS
) --schedule
=$(srcdir)/parallel_schedule
$(MAXCONNOPT
) numeric_big
149 clean distclean: clean-lib
150 # things built by `all' target
151 rm -f
$(OBJS
) refint
$(DLSUFFIX
) autoinc
$(DLSUFFIX
)
152 rm -f pg_regress_main.o pg_regress.o pg_regress
$(X
)
153 # things created by various check targets
154 rm -rf
$(pg_regress_clean_files
)