diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-11-02 21:56:15 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-11-02 21:56:15 +0000 |
commit | eeaf5f04ae3fca446b43851fb9a612fe0c980994 (patch) | |
tree | 68c5348cdc86637f6a934d8d8bdc52aabe42b700 /src | |
parent | 4593531205218524b104e19b727345e0729d7376 (diff) | |
download | postgresql-eeaf5f04ae3fca446b43851fb9a612fe0c980994.tar.gz postgresql-eeaf5f04ae3fca446b43851fb9a612fe0c980994.zip |
Provide a way to run the parallel regression tests with a user-specified
limit on the number of simultaneous connections. Andrew Dunstan, with
review by Tom Lane.
Diffstat (limited to 'src')
-rw-r--r-- | src/test/regress/GNUmakefile | 12 | ||||
-rw-r--r-- | src/test/regress/pg_regress.sh | 69 |
2 files changed, 61 insertions, 20 deletions
diff --git a/src/test/regress/GNUmakefile b/src/test/regress/GNUmakefile index 5279204b3b6..eb54dce64b6 100644 --- a/src/test/regress/GNUmakefile +++ b/src/test/regress/GNUmakefile @@ -7,7 +7,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/test/regress/GNUmakefile,v 1.42 2003/03/21 17:18:34 petere Exp $ +# $Header: /cvsroot/pgsql/src/test/regress/GNUmakefile,v 1.43 2003/11/02 21:56:15 tgl Exp $ # #------------------------------------------------------------------------- @@ -25,6 +25,12 @@ SHLIB_LINK = $(BE_DLLLIBS) # default encoding MULTIBYTE = SQL_ASCII +# maximum simultaneous connections for parallel tests +MAXCONNOPT := +ifdef MAX_CONNECTIONS +MAXCONNOPT += --max-connections=$(MAX_CONNECTIONS) +endif + ## ## Prepare for tests @@ -113,7 +119,7 @@ all-spi: ## check: all - $(SHELL) ./pg_regress --temp-install --top-builddir=$(top_builddir) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) + $(SHELL) ./pg_regress --temp-install --top-builddir=$(top_builddir) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) $(MAXCONNOPT) installcheck: all $(SHELL) ./pg_regress --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE) @@ -128,7 +134,7 @@ bigtest: $(SHELL) ./pg_regress --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE) numeric_big bigcheck: - $(SHELL) ./pg_regress --temp-install --top-builddir=$(top_builddir) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) numeric_big + $(SHELL) ./pg_regress --temp-install --top-builddir=$(top_builddir) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) $(MAXCONNOPT) numeric_big ## diff --git a/src/test/regress/pg_regress.sh b/src/test/regress/pg_regress.sh index 89eca958665..dfa57467c10 100644 --- a/src/test/regress/pg_regress.sh +++ b/src/test/regress/pg_regress.sh @@ -1,5 +1,5 @@ #! /bin/sh -# $Header: /cvsroot/pgsql/src/test/regress/Attic/pg_regress.sh,v 1.35 2003/08/07 14:36:31 tgl Exp $ +# $Header: /cvsroot/pgsql/src/test/regress/Attic/pg_regress.sh,v 1.36 2003/11/02 21:56:15 tgl Exp $ me=`basename $0` : ${TMPDIR=/tmp} @@ -13,6 +13,8 @@ Usage: $me [options...] [extra tests...] Options: --debug turn on debug mode in programs that are run --inputdir=DIR take input files from DIR (default \`.') + --max-connections=N maximum number of concurrent connections + (default is 0 meaning unlimited) --multibyte=ENCODING use ENCODING as the multibyte encoding, and also run a test by the same name --outputdir=DIR place output files in DIR (default \`.') @@ -92,6 +94,7 @@ unset multibyte dbname=regression hostname=localhost +maxconnections=0 : ${GMAKE='@GMAKE@'} @@ -124,6 +127,9 @@ do --temp-install=*) temp_install=`expr "x$1" : "x--temp-install=\(.*\)"` shift;; + --max-connections=*) + maxconnections=`expr "x$1" : "x--max-connections=\(.*\)"` + shift;; --outputdir=*) outputdir=`expr "x$1" : "x--outputdir=\(.*\)"` shift;; @@ -156,6 +162,26 @@ do esac done +# ---------- +# warn of Cygwin likely failure if maxconnections = 0 +# and we are running parallel tests +# ---------- + +case $host_platform in + *-*-cygwin*) + case "$schedule" in + *parallel_schedule*) + if [ $maxconnections -eq 0 ] ; then + echo Using unlimited parallel connections is likely to fail or hang on Cygwin. + echo Try \"$me --max-connections=n\" or \"gmake MAX_CONNECTIONS=n check\" + echo with n = 5 or 10 if this happens. + echo + fi + ;; + esac + ;; +esac + # ---------- # When on QNX or BeOS, don't use Unix sockets. @@ -248,15 +274,15 @@ if [ -f "$inputdir/resultmap" ] then while read LINE do - HOSTPAT=`expr "$LINE" : '.*/\(.*\)='` - if [ `expr "$host_platform:$compiler" : "$HOSTPAT"` -ne 0 ] - then - # remove hostnamepattern from line so that there are no shell - # wildcards in SUBSTLIST; else later 'for' could expand them! - TESTNAME=`expr "$LINE" : '\(.*\)/'` - SUBST=`echo "$LINE" | sed 's/^.*=//'` - echo "$TESTNAME=$SUBST" >> $TMPFILE - fi + HOSTPAT=`expr "$LINE" : '.*/\(.*\)='` + if [ `expr "$host_platform:$compiler" : "$HOSTPAT"` -ne 0 ] + then + # remove hostnamepattern from line so that there are no shell + # wildcards in SUBSTLIST; else later 'for' could expand them! + TESTNAME=`expr "$LINE" : '\(.*\)/'` + SUBST=`echo "$LINE" | sed 's/^.*=//'` + echo "$TESTNAME=$SUBST" >> $TMPFILE + fi done <"$inputdir/resultmap" fi SUBSTLIST=`cat $TMPFILE` @@ -309,10 +335,11 @@ then # Windows needs shared libraries in PATH. (Only those linked into # executables, not dlopen'ed ones) # ---------- - case $host_platform in *-*-cygwin*) - PATH=$libdir:$PATH - export PATH - ;; + case $host_platform in + *-*-cygwin*) + PATH=$libdir:$PATH + export PATH + ;; esac if [ -d "$temp_install" ]; then @@ -556,11 +583,19 @@ do else # Start a parallel group $ECHO_N "parallel group ($# tests): $ECHO_C" + if [ $maxconnections -gt 0 ] ; then + connnum=0 + test $# -gt $maxconnections && $ECHO_N "(in groups of $maxconnections) $ECHO_C" + fi for name do ( - $PSQL -d "$dbname" <"$inputdir/sql/$name.sql" >"$outputdir/results/$name.out" 2>&1 + $PSQL -d "$dbname" <"$inputdir/sql/$name.sql" >"$outputdir/results/$name.out" 2>&1 $ECHO_N " $name$ECHO_C" ) & + if [ $maxconnections -gt 0 ] ; then + connnum=`expr \( $connnum + 1 \) % $maxconnections` + test $connnum -eq 0 && wait + fi done wait echo @@ -593,8 +628,8 @@ do fi done - # If there are multiple equally valid result file, loop to get the right one. - # If none match, diff against the closet one. + # If there are multiple equally valid result files, loop to get the right one. + # If none match, diff against the closest one. bestfile= bestdiff= |