Commit 5521658e authored by Tom Lane's avatar Tom Lane

Add description of new parallel regression testing method; update

procedure to cover running either test script; other minor improvements.
parent 4e9c5347
<Chapter Id="regress"> <Chapter Id="regress">
<Title>Regression Test</Title> <Title id="regress-title">Regression Test</Title>
<Abstract> <Abstract>
<Para> <Para>
...@@ -13,6 +13,31 @@ Regression test instructions and analysis. ...@@ -13,6 +13,31 @@ Regression test instructions and analysis.
operations as well as the extended capabilities of PostgreSQL. operations as well as the extended capabilities of PostgreSQL.
</Para> </Para>
<Para>
There are two different ways in which the regression tests can be run:
the "sequential" method and the "parallel" method. The sequential method
runs each test script in turn, whereas the parallel method starts up
multiple server processes to run groups of tests in parallel. Parallel
testing gives confidence that interprocess communication and locking
are working correctly. Another key difference is that the sequential
test procedure uses an already-installed postmaster, whereas the
parallel test procedure tests a system that has been built but not yet
installed. (The parallel test script actually does an installation into
a temporary directory and fires up a private postmaster therein.)
</Para>
<Para>
Some properly installed and fully functional PostgreSQL installations
can "fail" some of these regression tests due to artifacts of floating point
representation and time zone support. The tests are currently evaluated
using a simple <application>diff</application> comparison against the
outputs generated on a reference system, so the results are sensitive to
small system differences.
When a test is reported as "failed", always examine the differences
between expected and actual results; you may well find that the differences
are not significant.
</Para>
<Para> <Para>
The regression tests were originally developed by Jolly Chen and Andrew Yu, The regression tests were originally developed by Jolly Chen and Andrew Yu,
and were extensively revised/repackaged by Marc Fournier and Thomas Lockhart. and were extensively revised/repackaged by Marc Fournier and Thomas Lockhart.
...@@ -20,14 +45,8 @@ Regression test instructions and analysis. ...@@ -20,14 +45,8 @@ Regression test instructions and analysis.
the regression tests are current for every official release. the regression tests are current for every official release.
</Para> </Para>
<Para> <Sect1>
Some properly installed and fully functional PostgreSQL installations <Title>Regression Environment</Title>
can fail some of these regression tests due to artifacts of floating point
representation and time zone support. The current tests are evaluated
using a simple "diff" algorithm, and are sensitive to small system
differences. For apparently failed tests, examining the differences
may reveal that the differences are not significant.
</Para>
<Para> <Para>
The regression testing notes below assume the following (except where noted): The regression testing notes below assume the following (except where noted):
...@@ -60,22 +79,11 @@ The runtime path is /usr/local/pgsql (other paths are possible). ...@@ -60,22 +79,11 @@ The runtime path is /usr/local/pgsql (other paths are possible).
</ItemizedList> </ItemizedList>
</Para> </Para>
<Sect1>
<Title>Regression Environment</Title>
<Para>
To prepare for regression testing, do <Command>make all</Command> in the regression test
directory. This compiles a <Acronym>C</Acronym> program with PostgreSQL extension functions
into a shared library. Localized SQL scripts and output-comparison
files are also created for the tests that need them. The localization
replaces macros in the source files with absolute pathnames and user names.
</Para>
<Para> <Para>
Normally, the regression tests should be run as the postgres user since Normally, the regression tests should be run as the postgres user since
the 'src/test/regress' directory and sub-directories are owned by the the 'src/test/regress' directory and sub-directories are owned by the
postgres user. If you run the regression test as another user the postgres user. If you run the regression test as another user the
'src/test/regress' directory tree must be writeable to that user. 'src/test/regress' directory tree must be writeable by that user.
</Para> </Para>
<Para> <Para>
...@@ -131,6 +139,8 @@ The runtime path is /usr/local/pgsql (other paths are possible). ...@@ -131,6 +139,8 @@ The runtime path is /usr/local/pgsql (other paths are possible).
results/ .. .out files that contain what the results *actually* look results/ .. .out files that contain what the results *actually* look
like. Also used as temporary storage for table copy testing. like. Also used as temporary storage for table copy testing.
tmp_check/ temporary installation created by parallel testing script.
</ProgramListing> </ProgramListing>
</Para> </Para>
</Sect1> </Sect1>
...@@ -144,39 +154,48 @@ The runtime path is /usr/local/pgsql (other paths are possible). ...@@ -144,39 +154,48 @@ The runtime path is /usr/local/pgsql (other paths are possible).
like <FileName>ps</FileName> and <FileName>tar</FileName> vary wildly on what options you should use on each like <FileName>ps</FileName> and <FileName>tar</FileName> vary wildly on what options you should use on each
platform. <Emphasis>Use common sense</Emphasis> before typing in these commands. platform. <Emphasis>Use common sense</Emphasis> before typing in these commands.
</Para> </Para>
<Para>
For a fresh install or upgrading from previous releases of
<ProductName>Postgres</ProductName>:
</Para>
<Procedure> <Procedure>
<Title><ProductName>Postgres</ProductName> Regression Configuration</Title> <Title><ProductName>Postgres</ProductName> Regression Test</Title>
<Step Performance="required"> <Step Performance="required">
<Para> <Para>
The file /usr/src/pgsql/src/test/regress/README has detailed Prepare the files needed for the regression test with:
instructions for running and interpreting the regression tests. <ProgramListing>
A short version follows here: cd /usr/src/pgsql/src/test/regress
gmake clean
gmake all
</ProgramListing>
You can skip "gmake clean" if this is the first time you
are running the tests.
</para>
<Para>
This step compiles a <Acronym>C</Acronym>
program with PostgreSQL extension functions into a shared library.
Localized SQL scripts and output-comparison files are also created
for the tests that need them. The localization replaces macros in
the source files with absolute pathnames and user names.
</Para> </Para>
</step>
<Step Performance="optional">
<Para> <Para>
If the postmaster is not already running, start the postmaster on an If you intend to use the "sequential" test procedure, which tests
available window by typing an already-installed postmaster, be sure that the postmaster
is running. If it isn't already running,
start the postmaster in an available window by typing
<ProgramListing> <ProgramListing>
postmaster postmaster
</ProgramListing> </ProgramListing>
or start the postmaster daemon running in the background by typing or start the postmaster daemon running in the background by typing
<ProgramListing> <ProgramListing>
cd cd
nohup postmaster > regress.log 2>&1 & nohup postmaster > regress.log 2>&1 &
</ProgramListing> </ProgramListing>
</Para> The latter is probably preferable, since the regression test log
will be quite lengthy (60K or so, in
<Para> <ProductName>Postgres</ProductName> 7.0) and you might want to
Run postmaster from your <ProductName>Postgres</ProductName> super user account (typically review it for clues if things go wrong.
account postgres).
<Note> <Note>
<Para> <Para>
...@@ -186,56 +205,39 @@ The runtime path is /usr/local/pgsql (other paths are possible). ...@@ -186,56 +205,39 @@ The runtime path is /usr/local/pgsql (other paths are possible).
</Para> </Para>
</Step> </Step>
<Step Performance="optional">
<Para>
If you have previously invoked the regression test, clean up the
working directory with:
<ProgramListing>
cd /usr/src/pgsql/src/test/regress
gmake clean
</ProgramListing>
</para>
<Para>
You do not need to type "gmake clean" if this is the first time you
are running the tests.
</Para>
</step>
<Step Performance="required"> <Step Performance="required">
<Para> <Para>
Build the regression test. Type Run the regression tests. For a sequential test, type
<ProgramListing> <ProgramListing>
cd /usr/src/pgsql/src/test/regress cd /usr/src/pgsql/src/test/regress
gmake all gmake runtest
</ProgramListing> </ProgramListing>
</Para> For a parallel test, type
</Step>
<Step Performance="required">
<Para>
Run the regression tests. Type
<ProgramListing> <ProgramListing>
cd /usr/src/pgsql/src/test/regress cd /usr/src/pgsql/src/test/regress
gmake runtest gmake runcheck
</ProgramListing> </ProgramListing>
The sequential test just runs the test scripts using your
already-running postmaster.
The parallel test will perform a complete installation of
<ProductName>Postgres</ProductName> into a temporary directory,
start a private postmaster therein, and then run the test scripts.
Finally it will kill the private postmaster (but the temporary
directory isn't removed automatically).
</Para> </Para>
</Step> </Step>
<Step Performance="required"> <Step Performance="required">
<Para> <Para>
You should get on the screen (and also written to file ./regress.out) You should get on the screen (and also written to file ./regress.out)
a series of statements stating which tests passed and which tests a series of statements stating which tests passed and which tests
failed. Please note that it can be normal for some of the tests to failed. Please note that it can be normal for some of the tests to
"fail". For the failed tests, use diff to compare the files in "fail" due to platform-specific variations. See the next section
directories ./results and ./expected. If float8 failed, type for details on determining whether a "failure" is significant.
something like: </Para>
<ProgramListing> <Para>
cd /usr/src/pgsql/src/test/regress Some of the tests, notably "numeric", can take a while, especially
diff -w expected/float8.out results on slower platforms. Have patience.
</ProgramListing>
</Para> </Para>
</Step> </Step>
...@@ -243,11 +245,14 @@ The runtime path is /usr/local/pgsql (other paths are possible). ...@@ -243,11 +245,14 @@ The runtime path is /usr/local/pgsql (other paths are possible).
<Para> <Para>
After running the tests and examining the results, type After running the tests and examining the results, type
<ProgramListing> <ProgramListing>
dropdb regression
cd /usr/src/pgsql/src/test/regress cd /usr/src/pgsql/src/test/regress
gmake clean gmake clean
</ProgramListing> </ProgramListing>
to recover the temporary disk space used by the tests. to recover the temporary disk space used by the tests.
If you ran a sequential test, also type
<ProgramListing>
dropdb regression
</ProgramListing>
</Para> </Para>
</Step> </Step>
</procedure> </procedure>
...@@ -257,10 +262,14 @@ The runtime path is /usr/local/pgsql (other paths are possible). ...@@ -257,10 +262,14 @@ The runtime path is /usr/local/pgsql (other paths are possible).
<Title>Regression Analysis</Title> <Title>Regression Analysis</Title>
<Para> <Para>
The results are in files in the ./results directory. These results The actual outputs of the regression tests are in files in the
can be compared with results in the ./expected directory using 'diff'. <filename>./results</filename> directory. The test script
(The test script does this for you, and leaves the differences uses <application>diff</application> to compare each output file
in ./regression.diffs.) against the reference outputs stored in the
<filename>./expected</filename> directory. Any differences are
saved for your inspection in
<filename>./regression.diffs</filename>. (Or you can run
<application>diff</application> yourself, if you prefer.)
</Para> </Para>
<Para> <Para>
...@@ -354,7 +363,7 @@ The runtime path is /usr/local/pgsql (other paths are possible). ...@@ -354,7 +363,7 @@ The runtime path is /usr/local/pgsql (other paths are possible).
When comparing the results from different platforms, differences occur When comparing the results from different platforms, differences occur
in the 2nd or 3rd place to the right of the decimal point. The SQL in the 2nd or 3rd place to the right of the decimal point. The SQL
statements where these problems occur are the folowing: statements where these problems occur are the following:
<ProgramListing> <ProgramListing>
QUERY: SELECT * from street; QUERY: SELECT * from street;
...@@ -368,18 +377,19 @@ The runtime path is /usr/local/pgsql (other paths are possible). ...@@ -368,18 +377,19 @@ The runtime path is /usr/local/pgsql (other paths are possible).
<Title>Random differences</Title> <Title>Random differences</Title>
<Para> <Para>
There is at least one test case in random.out which is intended to produce There is at least one case in the "random" test script that is
random results. This causes random to fail the regression testing intended to produce
once in a while. random results. This causes random to fail the regression test
once in a while (perhaps once in every five to ten trials).
Typing Typing
<ProgramListing> <ProgramListing>
diff results/random.out expected/random.out diff results/random.out expected/random.out
</ProgramListing> </ProgramListing>
should produce only one or a few lines of differences. You need
should produce only not worry unless the random test always fails in repeated attempts.
one or a few lines of differences for this reason, but other floating (On the other hand, if the random test is <emphasis>never</emphasis>
point differences on dissimilar architectures might cause many more reported to fail even in many trials of the regress tests, you
differences. See the release notes below. probably <emphasis>should</emphasis> worry.)
</Para> </Para>
</Sect2> </Sect2>
...@@ -398,10 +408,10 @@ The runtime path is /usr/local/pgsql (other paths are possible). ...@@ -398,10 +408,10 @@ The runtime path is /usr/local/pgsql (other paths are possible).
system using the <FileName>postgres5-1.02a5.tar.gz</FileName> source tree. It was compared system using the <FileName>postgres5-1.02a5.tar.gz</FileName> source tree. It was compared
with a file created on an I386 Solaris 2.4 system and the differences with a file created on an I386 Solaris 2.4 system and the differences
were only in the floating point polygons in the 3rd digit to the right were only in the floating point polygons in the 3rd digit to the right
of the decimal point. (see below) of the decimal point.
The original <FileName>sample.regress.out</FileName> file was from the postgres-1.01 release The original <FileName>sample.regress.out</FileName> file was from the postgres-1.01 release
constructed by Jolly Chen and is included here for reference. It may constructed by Jolly Chen. It may
have been created on a DEC ALPHA machine as the <FileName>Makefile.global</FileName> have been created on a DEC ALPHA machine as the <FileName>Makefile.global</FileName>
in the postgres-1.01 release has PORTNAME=alpha. in the postgres-1.01 release has PORTNAME=alpha.
</Para> </Para>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment