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.
This commit is contained in:
parent
4593531205
commit
eeaf5f04ae
|
@ -1,4 +1,4 @@
|
||||||
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/regress.sgml,v 1.34 2003/09/12 22:17:23 tgl Exp $ -->
|
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/regress.sgml,v 1.35 2003/11/02 21:56:14 tgl Exp $ -->
|
||||||
|
|
||||||
<chapter id="regress">
|
<chapter id="regress">
|
||||||
<title id="regress-title">Regression Tests</title>
|
<title id="regress-title">Regression Tests</title>
|
||||||
|
@ -52,18 +52,18 @@ gmake check
|
||||||
<screen>
|
<screen>
|
||||||
<computeroutput>
|
<computeroutput>
|
||||||
======================
|
======================
|
||||||
All 77 tests passed.
|
All 93 tests passed.
|
||||||
======================
|
======================
|
||||||
</computeroutput>
|
</computeroutput>
|
||||||
</screen>
|
</screen>
|
||||||
or otherwise a note about what tests failed. See <xref
|
or otherwise a note about which tests failed. See <xref
|
||||||
linkend="regress-evaluation"> below for more.
|
linkend="regress-evaluation"> below for more.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<note>
|
<note>
|
||||||
<para>
|
<para>
|
||||||
Because this test method runs a temporary server, it will not work
|
Because this test method runs a temporary server, it will not work
|
||||||
when you are the root user (the server will not start as root).
|
when you are the root user (since the server will not start as root).
|
||||||
If you already did the build as root, you do not have to start all
|
If you already did the build as root, you do not have to start all
|
||||||
over. Instead, make the regression test directory writable by
|
over. Instead, make the regression test directory writable by
|
||||||
some other user, log in as that user, and restart the tests.
|
some other user, log in as that user, and restart the tests.
|
||||||
|
@ -88,14 +88,18 @@ gmake check
|
||||||
<para>
|
<para>
|
||||||
The parallel regression test starts quite a few processes under your
|
The parallel regression test starts quite a few processes under your
|
||||||
user ID. Presently, the maximum concurrency is twenty parallel test
|
user ID. Presently, the maximum concurrency is twenty parallel test
|
||||||
scripts, which means sixty processes: there's a server process, a <application>psql</>,
|
scripts, which means sixty processes: there's a server process, a
|
||||||
and usually a shell parent process for the <application>psql</> for each test script.
|
<application>psql</>, and usually a shell parent process for the
|
||||||
|
<application>psql</> for each test script.
|
||||||
So if your system enforces a per-user limit on the number of processes,
|
So if your system enforces a per-user limit on the number of processes,
|
||||||
make sure this limit is at least seventy-five or so, else you may get
|
make sure this limit is at least seventy-five or so, else you may get
|
||||||
random-seeming failures in the parallel test. If you are not in
|
random-seeming failures in the parallel test. If you are not in
|
||||||
a position to raise the limit, you can edit the file
|
a position to raise the limit, you can cut down the degree of parallelism
|
||||||
<filename>src/test/regress/parallel_schedule</> to split the
|
by setting the <literal>MAX_CONNECTIONS</> parameter. For example,
|
||||||
larger concurrent test sets into more manageable groups.
|
<screen>
|
||||||
|
gmake MAX_CONNECTIONS=10 check
|
||||||
|
</screen>
|
||||||
|
runs no more than ten tests concurrently.
|
||||||
</para>
|
</para>
|
||||||
</tip>
|
</tip>
|
||||||
|
|
||||||
|
@ -109,8 +113,8 @@ gmake check
|
||||||
<screen>
|
<screen>
|
||||||
gmake SHELL=/bin/ksh check
|
gmake SHELL=/bin/ksh check
|
||||||
</screen>
|
</screen>
|
||||||
If no non-broken shell is available, you can alter the parallel test
|
If no non-broken shell is available, you may be able to work around the
|
||||||
schedule as suggested above.
|
problem by limiting the number of connections, as shown above.
|
||||||
</para>
|
</para>
|
||||||
</tip>
|
</tip>
|
||||||
|
|
||||||
|
@ -177,7 +181,7 @@ gmake installcheck
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
If you run the tests against an already-installed server that was
|
If you run the tests against an already-installed server that was
|
||||||
initialized with a collation order locale different than C then
|
initialized with a collation-order locale other than C, then
|
||||||
there may be differences due to sort order and follow-up
|
there may be differences due to sort order and follow-up
|
||||||
failures. The regression test suite is set up to handle this
|
failures. The regression test suite is set up to handle this
|
||||||
problem by providing alternative result files that together are
|
problem by providing alternative result files that together are
|
||||||
|
@ -199,7 +203,7 @@ gmake installcheck
|
||||||
<literal><replaceable>testname</>_<replaceable>digit</>.out</>.
|
<literal><replaceable>testname</>_<replaceable>digit</>.out</>.
|
||||||
The actual digit is not significant. Remember that the
|
The actual digit is not significant. Remember that the
|
||||||
regression test driver will consider all such files to be equally
|
regression test driver will consider all such files to be equally
|
||||||
valid test results. If the test results are platform-dependent,
|
valid test results. If the test results are platform-specific,
|
||||||
the technique described in <xref linkend="regress-platform">
|
the technique described in <xref linkend="regress-platform">
|
||||||
should be used instead.
|
should be used instead.
|
||||||
</para>
|
</para>
|
||||||
|
@ -245,7 +249,7 @@ env TZ=PST8PDT date
|
||||||
</screen>
|
</screen>
|
||||||
The command above should have returned the current system time in
|
The command above should have returned the current system time in
|
||||||
the <literal>PST8PDT</literal> time zone. If the <literal>PST8PDT</literal> time zone is not available,
|
the <literal>PST8PDT</literal> time zone. If the <literal>PST8PDT</literal> time zone is not available,
|
||||||
then your system may have returned the time in GMT. If the
|
then your system may have returned the time in UTC. If the
|
||||||
<literal>PST8PDT</literal> time zone is missing, you can set the time zone
|
<literal>PST8PDT</literal> time zone is missing, you can set the time zone
|
||||||
rules explicitly:
|
rules explicitly:
|
||||||
<programlisting>
|
<programlisting>
|
||||||
|
@ -364,7 +368,7 @@ diff results/random.out expected/random.out
|
||||||
which comparison file to use. So, to eliminate bogus test
|
which comparison file to use. So, to eliminate bogus test
|
||||||
<quote>failures</quote> for a particular platform, you must choose
|
<quote>failures</quote> for a particular platform, you must choose
|
||||||
or make a variant result file, and then add a line to the mapping
|
or make a variant result file, and then add a line to the mapping
|
||||||
file, which is <filename>resultmap</filename>.
|
file, which is <filename>src/test/regress/resultmap</filename>.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# IDENTIFICATION
|
# 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
|
# default encoding
|
||||||
MULTIBYTE = SQL_ASCII
|
MULTIBYTE = SQL_ASCII
|
||||||
|
|
||||||
|
# maximum simultaneous connections for parallel tests
|
||||||
|
MAXCONNOPT :=
|
||||||
|
ifdef MAX_CONNECTIONS
|
||||||
|
MAXCONNOPT += --max-connections=$(MAX_CONNECTIONS)
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
## Prepare for tests
|
## Prepare for tests
|
||||||
|
@ -113,7 +119,7 @@ all-spi:
|
||||||
##
|
##
|
||||||
|
|
||||||
check: all
|
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
|
installcheck: all
|
||||||
$(SHELL) ./pg_regress --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE)
|
$(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
|
$(SHELL) ./pg_regress --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE) numeric_big
|
||||||
|
|
||||||
bigcheck:
|
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
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#! /bin/sh
|
#! /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`
|
me=`basename $0`
|
||||||
: ${TMPDIR=/tmp}
|
: ${TMPDIR=/tmp}
|
||||||
|
@ -13,6 +13,8 @@ Usage: $me [options...] [extra tests...]
|
||||||
Options:
|
Options:
|
||||||
--debug turn on debug mode in programs that are run
|
--debug turn on debug mode in programs that are run
|
||||||
--inputdir=DIR take input files from DIR (default \`.')
|
--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
|
--multibyte=ENCODING use ENCODING as the multibyte encoding, and
|
||||||
also run a test by the same name
|
also run a test by the same name
|
||||||
--outputdir=DIR place output files in DIR (default \`.')
|
--outputdir=DIR place output files in DIR (default \`.')
|
||||||
|
@ -92,6 +94,7 @@ unset multibyte
|
||||||
|
|
||||||
dbname=regression
|
dbname=regression
|
||||||
hostname=localhost
|
hostname=localhost
|
||||||
|
maxconnections=0
|
||||||
|
|
||||||
: ${GMAKE='@GMAKE@'}
|
: ${GMAKE='@GMAKE@'}
|
||||||
|
|
||||||
|
@ -124,6 +127,9 @@ do
|
||||||
--temp-install=*)
|
--temp-install=*)
|
||||||
temp_install=`expr "x$1" : "x--temp-install=\(.*\)"`
|
temp_install=`expr "x$1" : "x--temp-install=\(.*\)"`
|
||||||
shift;;
|
shift;;
|
||||||
|
--max-connections=*)
|
||||||
|
maxconnections=`expr "x$1" : "x--max-connections=\(.*\)"`
|
||||||
|
shift;;
|
||||||
--outputdir=*)
|
--outputdir=*)
|
||||||
outputdir=`expr "x$1" : "x--outputdir=\(.*\)"`
|
outputdir=`expr "x$1" : "x--outputdir=\(.*\)"`
|
||||||
shift;;
|
shift;;
|
||||||
|
@ -156,6 +162,26 @@ do
|
||||||
esac
|
esac
|
||||||
done
|
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.
|
# When on QNX or BeOS, don't use Unix sockets.
|
||||||
|
@ -309,7 +335,8 @@ then
|
||||||
# Windows needs shared libraries in PATH. (Only those linked into
|
# Windows needs shared libraries in PATH. (Only those linked into
|
||||||
# executables, not dlopen'ed ones)
|
# executables, not dlopen'ed ones)
|
||||||
# ----------
|
# ----------
|
||||||
case $host_platform in *-*-cygwin*)
|
case $host_platform in
|
||||||
|
*-*-cygwin*)
|
||||||
PATH=$libdir:$PATH
|
PATH=$libdir:$PATH
|
||||||
export PATH
|
export PATH
|
||||||
;;
|
;;
|
||||||
|
@ -556,11 +583,19 @@ do
|
||||||
else
|
else
|
||||||
# Start a parallel group
|
# Start a parallel group
|
||||||
$ECHO_N "parallel group ($# tests): $ECHO_C"
|
$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
|
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"
|
$ECHO_N " $name$ECHO_C"
|
||||||
) &
|
) &
|
||||||
|
if [ $maxconnections -gt 0 ] ; then
|
||||||
|
connnum=`expr \( $connnum + 1 \) % $maxconnections`
|
||||||
|
test $connnum -eq 0 && wait
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
wait
|
wait
|
||||||
echo
|
echo
|
||||||
|
@ -593,8 +628,8 @@ do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# If there are multiple equally valid result file, loop to get the right one.
|
# If there are multiple equally valid result files, loop to get the right one.
|
||||||
# If none match, diff against the closet one.
|
# If none match, diff against the closest one.
|
||||||
|
|
||||||
bestfile=
|
bestfile=
|
||||||
bestdiff=
|
bestdiff=
|
||||||
|
|
Loading…
Reference in New Issue