]> granicus.if.org Git - postgresql/blobdiff - src/test/regress/GNUmakefile
Enforce our convention about max number of parallel regression tests.
[postgresql] / src / test / regress / GNUmakefile
index c7e7c220784622b6b9169acf0b421237446ebc47..56cd2020787c14c5f524ed13b0718ba13c9471cd 100644 (file)
@@ -3,44 +3,28 @@
 # GNUmakefile--
 #    Makefile for src/test/regress (the regression tests)
 #
-# Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
+# Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
 # Portions Copyright (c) 1994, Regents of the University of California
 #
-# $PostgreSQL: pgsql/src/test/regress/GNUmakefile,v 1.79 2009/10/26 21:11:22 petere Exp $
+# src/test/regress/GNUmakefile
 #
 #-------------------------------------------------------------------------
 
+PGFILEDESC = "pg_regress - test driver"
+PGAPPICON = win32
+
 subdir = src/test/regress
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
-# file with extra config for temp build
-TEMP_CONF =
-ifdef TEMP_CONFIG
-TEMP_CONF += --temp-config=$(TEMP_CONFIG)
-endif
-
-# where to find psql for testing an existing installation
-PSQLDIR = $(bindir)
-
-# default encoding
-MULTIBYTE = SQL_ASCII
-
 # maximum simultaneous connections for parallel tests
 MAXCONNOPT =
 ifdef MAX_CONNECTIONS
 MAXCONNOPT += --max-connections=$(MAX_CONNECTIONS)
 endif
 
-# locale
-NOLOCALE =
-ifdef NO_LOCALE
-NOLOCALE += --no-locale
-endif
-
 # stuff to pass into build of pg_regress
 EXTRADEFS = '-DHOST_TUPLE="$(host_tuple)"' \
-       '-DMAKEPROG="$(MAKE)"' \
        '-DSHELLPROG="$(SHELL)"' \
        '-DDLSUFFIX="$(DLSUFFIX)"'
 
@@ -50,14 +34,14 @@ EXTRADEFS = '-DHOST_TUPLE="$(host_tuple)"' \
 
 # Build regression test driver
 
-all: submake-libpgport pg_regress$(X)
+all: pg_regress$(X)
 
-pg_regress$(X): pg_regress.o pg_regress_main.o
-       $(CC) $(CFLAGS) $^ $(LDFLAGS) $(LIBS) -o $@
+pg_regress$(X): pg_regress.o pg_regress_main.o $(WIN32RES) | submake-libpgport
+       $(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@
 
 # dependencies ensure that path changes propagate
 pg_regress.o: pg_regress.c $(top_builddir)/src/port/pg_config_paths.h
-       $(CC) $(CFLAGS) $(CPPFLAGS) -I$(top_builddir)/src/port $(EXTRADEFS) -c -o $@ $<
+pg_regress.o: override CPPFLAGS += -I$(top_builddir)/src/port $(EXTRADEFS)
 
 $(top_builddir)/src/port/pg_config_paths.h: $(top_builddir)/src/Makefile.global
        $(MAKE) -C $(top_builddir)/src/port pg_config_paths.h
@@ -75,12 +59,14 @@ uninstall:
 # Build dynamically-loaded object file for CREATE FUNCTION ... LANGUAGE C.
 
 NAME = regress
-OBJS = regress.o
+OBJS = $(WIN32RES) regress.o
 
 include $(top_srcdir)/src/Makefile.shlib
 
 all: all-lib
 
+$(OBJS): | submake-generated-headers
+
 # Test input and expected files.  These are created by pg_regress itself, so we
 # don't have a rule to create them.  We do need rules to clean them however.
 input_files = $(patsubst $(srcdir)/input/%.source,sql/%.sql, $(wildcard $(srcdir)/input/*.source))
@@ -107,7 +93,7 @@ installdirs-tests: installdirs
        $(MKDIR_P)  $(patsubst $(srcdir)/%/,'$(DESTDIR)$(pkglibdir)/regress/%',$(sort $(dir $(regress_data_files))))
 
 
-# Get some extra C modules from contrib/spi...
+# Get some extra C modules from contrib/spi
 
 all: refint$(DLSUFFIX) autoinc$(DLSUFFIX)
 
@@ -117,16 +103,16 @@ refint$(DLSUFFIX): $(top_builddir)/contrib/spi/refint$(DLSUFFIX)
 autoinc$(DLSUFFIX): $(top_builddir)/contrib/spi/autoinc$(DLSUFFIX)
        cp $< $@
 
-$(top_builddir)/contrib/spi/refint$(DLSUFFIX): $(top_srcdir)/contrib/spi/refint.c
-       $(MAKE) -C $(top_builddir)/contrib/spi refint$(DLSUFFIX)
+$(top_builddir)/contrib/spi/refint$(DLSUFFIX): | submake-contrib-spi ;
 
-$(top_builddir)/contrib/spi/autoinc$(DLSUFFIX): $(top_srcdir)/contrib/spi/autoinc.c
-       $(MAKE) -C $(top_builddir)/contrib/spi autoinc$(DLSUFFIX)
+$(top_builddir)/contrib/spi/autoinc$(DLSUFFIX): | submake-contrib-spi ;
 
+submake-contrib-spi: | submake-libpgport submake-generated-headers
+       $(MAKE) -C $(top_builddir)/contrib/spi
 
-# Tablespace setup
+.PHONY: submake-contrib-spi
 
-all: tablespace-setup
+# Tablespace setup
 
 .PHONY: tablespace-setup
 tablespace-setup:
@@ -138,17 +124,25 @@ tablespace-setup:
 ## Run tests
 ##
 
-pg_regress_call = ./pg_regress --inputdir=$(srcdir) --dlpath=. --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE)
+REGRESS_OPTS = --dlpath=. --max-concurrent-tests=20 $(EXTRA_REGRESS_OPTS)
+
+check: all tablespace-setup
+       $(pg_regress_check) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(EXTRA_TESTS)
+
+check-tests: all tablespace-setup
+       $(pg_regress_check) $(REGRESS_OPTS) $(MAXCONNOPT) $(TESTS) $(EXTRA_TESTS)
 
-check: all
-       $(pg_regress_call) --temp-install=./tmp_check --top-builddir=$(top_builddir) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(TEMP_CONF)
+installcheck: all tablespace-setup
+       $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/serial_schedule $(EXTRA_TESTS)
 
-installcheck: all
-       $(pg_regress_call) --psqldir=$(PSQLDIR) --schedule=$(srcdir)/serial_schedule
+installcheck-parallel: all tablespace-setup
+       $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(EXTRA_TESTS)
 
-installcheck-parallel: all
-       $(pg_regress_call) --psqldir=$(PSQLDIR) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT)
+installcheck-tests: all tablespace-setup
+       $(pg_regress_installcheck) $(REGRESS_OPTS) $(TESTS) $(EXTRA_TESTS)
 
+standbycheck: all
+       $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/standby_schedule --use-existing
 
 # old interfaces follow...
 
@@ -156,11 +150,11 @@ runcheck: check
 runtest: installcheck
 runtest-parallel: installcheck-parallel
 
-bigtest: all
-       $(pg_regress_call) --psqldir=$(PSQLDIR) --schedule=$(srcdir)/serial_schedule numeric_big 
+bigtest: all tablespace-setup
+       $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/serial_schedule numeric_big
 
-bigcheck: all
-       $(pg_regress_call) --temp-install=./tmp_check --top-builddir=$(top_builddir) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) numeric_big
+bigcheck: all tablespace-setup
+       $(pg_regress_check) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) numeric_big
 
 
 ##
@@ -169,9 +163,9 @@ bigcheck: all
 
 clean distclean maintainer-clean: clean-lib
 # things built by `all' target
-       rm -f $(OBJS) refint$(DLSUFFIX) autoinc$(DLSUFFIX) pg_regress_main.o pg_regress.o pg_regress$(X)
+       rm -f $(OBJS) refint$(DLSUFFIX) autoinc$(DLSUFFIX)
+       rm -f pg_regress_main.o pg_regress.o pg_regress$(X)
 # things created by various check targets
        rm -f $(output_files) $(input_files)
        rm -rf testtablespace
-       rm -rf results tmp_check log
-       rm -f regression.diffs regression.out regress.out run_check.out
+       rm -rf $(pg_regress_clean_files)