Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5521658

Browse files
committed
Add description of new parallel regression testing method; update
procedure to cover running either test script; other minor improvements.
1 parent 4e9c534 commit 5521658

File tree

1 file changed

+100
-90
lines changed

1 file changed

+100
-90
lines changed

doc/src/sgml/regress.sgml

Lines changed: 100 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Chapter Id="regress">
2-
<Title>Regression Test</Title>
2+
<Title id="regress-title">Regression Test</Title>
33

44
<Abstract>
55
<Para>
@@ -13,21 +13,40 @@ Regression test instructions and analysis.
1313
operations as well as the extended capabilities of PostgreSQL.
1414
</Para>
1515

16+
<Para>
17+
There are two different ways in which the regression tests can be run:
18+
the "sequential" method and the "parallel" method. The sequential method
19+
runs each test script in turn, whereas the parallel method starts up
20+
multiple server processes to run groups of tests in parallel. Parallel
21+
testing gives confidence that interprocess communication and locking
22+
are working correctly. Another key difference is that the sequential
23+
test procedure uses an already-installed postmaster, whereas the
24+
parallel test procedure tests a system that has been built but not yet
25+
installed. (The parallel test script actually does an installation into
26+
a temporary directory and fires up a private postmaster therein.)
27+
</Para>
28+
29+
<Para>
30+
Some properly installed and fully functional PostgreSQL installations
31+
can "fail" some of these regression tests due to artifacts of floating point
32+
representation and time zone support. The tests are currently evaluated
33+
using a simple <application>diff</application> comparison against the
34+
outputs generated on a reference system, so the results are sensitive to
35+
small system differences.
36+
When a test is reported as "failed", always examine the differences
37+
between expected and actual results; you may well find that the differences
38+
are not significant.
39+
</Para>
40+
1641
<Para>
1742
The regression tests were originally developed by Jolly Chen and Andrew Yu,
1843
and were extensively revised/repackaged by Marc Fournier and Thomas Lockhart.
1944
From <ProductName>PostgreSQL</ProductName> v6.1 onward
2045
the regression tests are current for every official release.
2146
</Para>
2247

23-
<Para>
24-
Some properly installed and fully functional PostgreSQL installations
25-
can fail some of these regression tests due to artifacts of floating point
26-
representation and time zone support. The current tests are evaluated
27-
using a simple "diff" algorithm, and are sensitive to small system
28-
differences. For apparently failed tests, examining the differences
29-
may reveal that the differences are not significant.
30-
</Para>
48+
<Sect1>
49+
<Title>Regression Environment</Title>
3150

3251
<Para>
3352
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).
6079
</ItemizedList>
6180
</Para>
6281

63-
<Sect1>
64-
<Title>Regression Environment</Title>
65-
66-
<Para>
67-
To prepare for regression testing, do <Command>make all</Command> in the regression test
68-
directory. This compiles a <Acronym>C</Acronym> program with PostgreSQL extension functions
69-
into a shared library. Localized SQL scripts and output-comparison
70-
files are also created for the tests that need them. The localization
71-
replaces macros in the source files with absolute pathnames and user names.
72-
</Para>
73-
7482
<Para>
7583
Normally, the regression tests should be run as the postgres user since
7684
the 'src/test/regress' directory and sub-directories are owned by the
7785
postgres user. If you run the regression test as another user the
78-
'src/test/regress' directory tree must be writeable to that user.
86+
'src/test/regress' directory tree must be writeable by that user.
7987
</Para>
8088

8189
<Para>
@@ -131,6 +139,8 @@ The runtime path is /usr/local/pgsql (other paths are possible).
131139

132140
results/ .. .out files that contain what the results *actually* look
133141
like. Also used as temporary storage for table copy testing.
142+
143+
tmp_check/ temporary installation created by parallel testing script.
134144
</ProgramListing>
135145
</Para>
136146
</Sect1>
@@ -144,39 +154,48 @@ The runtime path is /usr/local/pgsql (other paths are possible).
144154
like <FileName>ps</FileName> and <FileName>tar</FileName> vary wildly on what options you should use on each
145155
platform. <Emphasis>Use common sense</Emphasis> before typing in these commands.
146156
</Para>
147-
148-
<Para>
149-
For a fresh install or upgrading from previous releases of
150-
<ProductName>Postgres</ProductName>:
151-
</Para>
152157

153158
<Procedure>
154-
<Title><ProductName>Postgres</ProductName> Regression Configuration</Title>
155-
159+
<Title><ProductName>Postgres</ProductName> Regression Test</Title>
160+
156161
<Step Performance="required">
157162
<Para>
158-
The file /usr/src/pgsql/src/test/regress/README has detailed
159-
instructions for running and interpreting the regression tests.
160-
A short version follows here:
163+
Prepare the files needed for the regression test with:
164+
<ProgramListing>
165+
cd /usr/src/pgsql/src/test/regress
166+
gmake clean
167+
gmake all
168+
</ProgramListing>
169+
You can skip "gmake clean" if this is the first time you
170+
are running the tests.
171+
</para>
172+
<Para>
173+
This step compiles a <Acronym>C</Acronym>
174+
program with PostgreSQL extension functions into a shared library.
175+
Localized SQL scripts and output-comparison files are also created
176+
for the tests that need them. The localization replaces macros in
177+
the source files with absolute pathnames and user names.
161178
</Para>
162-
179+
</step>
180+
181+
<Step Performance="optional">
163182
<Para>
164-
If the postmaster is not already running, start the postmaster on an
165-
available window by typing
183+
If you intend to use the "sequential" test procedure, which tests
184+
an already-installed postmaster, be sure that the postmaster
185+
is running. If it isn't already running,
186+
start the postmaster in an available window by typing
166187
<ProgramListing>
167188
postmaster
168189
</ProgramListing>
169-
170190
or start the postmaster daemon running in the background by typing
171191
<ProgramListing>
172192
cd
173193
nohup postmaster > regress.log 2>&1 &
174194
</ProgramListing>
175-
</Para>
176-
177-
<Para>
178-
Run postmaster from your <ProductName>Postgres</ProductName> super user account (typically
179-
account postgres).
195+
The latter is probably preferable, since the regression test log
196+
will be quite lengthy (60K or so, in
197+
<ProductName>Postgres</ProductName> 7.0) and you might want to
198+
review it for clues if things go wrong.
180199

181200
<Note>
182201
<Para>
@@ -186,68 +205,54 @@ The runtime path is /usr/local/pgsql (other paths are possible).
186205
</Para>
187206
</Step>
188207

189-
<Step Performance="optional">
190-
<Para>
191-
If you have previously invoked the regression test, clean up the
192-
working directory with:
193-
194-
<ProgramListing>
195-
cd /usr/src/pgsql/src/test/regress
196-
gmake clean
197-
</ProgramListing>
198-
</para>
199-
<Para>
200-
You do not need to type "gmake clean" if this is the first time you
201-
are running the tests.
202-
</Para>
203-
</step>
204-
205-
206208
<Step Performance="required">
207209
<Para>
208-
Build the regression test. Type
210+
Run the regression tests. For a sequential test, type
209211
<ProgramListing>
210212
cd /usr/src/pgsql/src/test/regress
211-
gmake all
213+
gmake runtest
212214
</ProgramListing>
213-
</Para>
214-
</Step>
215-
216-
<Step Performance="required">
217-
<Para>
218-
Run the regression tests. Type
215+
For a parallel test, type
219216
<ProgramListing>
220217
cd /usr/src/pgsql/src/test/regress
221-
gmake runtest
218+
gmake runcheck
222219
</ProgramListing>
220+
The sequential test just runs the test scripts using your
221+
already-running postmaster.
222+
The parallel test will perform a complete installation of
223+
<ProductName>Postgres</ProductName> into a temporary directory,
224+
start a private postmaster therein, and then run the test scripts.
225+
Finally it will kill the private postmaster (but the temporary
226+
directory isn't removed automatically).
223227
</Para>
224228
</Step>
225229

226230
<Step Performance="required">
227231
<Para>
228-
229232
You should get on the screen (and also written to file ./regress.out)
230233
a series of statements stating which tests passed and which tests
231234
failed. Please note that it can be normal for some of the tests to
232-
"fail". For the failed tests, use diff to compare the files in
233-
directories ./results and ./expected. If float8 failed, type
234-
something like:
235-
<ProgramListing>
236-
cd /usr/src/pgsql/src/test/regress
237-
diff -w expected/float8.out results
238-
</ProgramListing>
235+
"fail" due to platform-specific variations. See the next section
236+
for details on determining whether a "failure" is significant.
237+
</Para>
238+
<Para>
239+
Some of the tests, notably "numeric", can take a while, especially
240+
on slower platforms. Have patience.
239241
</Para>
240242
</Step>
241243

242244
<Step Performance="required">
243245
<Para>
244246
After running the tests and examining the results, type
245247
<ProgramListing>
246-
dropdb regression
247248
cd /usr/src/pgsql/src/test/regress
248249
gmake clean
249250
</ProgramListing>
250251
to recover the temporary disk space used by the tests.
252+
If you ran a sequential test, also type
253+
<ProgramListing>
254+
dropdb regression
255+
</ProgramListing>
251256
</Para>
252257
</Step>
253258
</procedure>
@@ -257,10 +262,14 @@ The runtime path is /usr/local/pgsql (other paths are possible).
257262
<Title>Regression Analysis</Title>
258263

259264
<Para>
260-
The results are in files in the ./results directory. These results
261-
can be compared with results in the ./expected directory using 'diff'.
262-
(The test script does this for you, and leaves the differences
263-
in ./regression.diffs.)
265+
The actual outputs of the regression tests are in files in the
266+
<filename>./results</filename> directory. The test script
267+
uses <application>diff</application> to compare each output file
268+
against the reference outputs stored in the
269+
<filename>./expected</filename> directory. Any differences are
270+
saved for your inspection in
271+
<filename>./regression.diffs</filename>. (Or you can run
272+
<application>diff</application> yourself, if you prefer.)
264273
</Para>
265274

266275
<Para>
@@ -354,7 +363,7 @@ The runtime path is /usr/local/pgsql (other paths are possible).
354363

355364
When comparing the results from different platforms, differences occur
356365
in the 2nd or 3rd place to the right of the decimal point. The SQL
357-
statements where these problems occur are the folowing:
366+
statements where these problems occur are the following:
358367

359368
<ProgramListing>
360369
QUERY: SELECT * from street;
@@ -368,18 +377,19 @@ The runtime path is /usr/local/pgsql (other paths are possible).
368377
<Title>Random differences</Title>
369378

370379
<Para>
371-
There is at least one test case in random.out which is intended to produce
372-
random results. This causes random to fail the regression testing
373-
once in a while.
380+
There is at least one case in the "random" test script that is
381+
intended to produce
382+
random results. This causes random to fail the regression test
383+
once in a while (perhaps once in every five to ten trials).
374384
Typing
375385
<ProgramListing>
376386
diff results/random.out expected/random.out
377387
</ProgramListing>
378-
379-
should produce only
380-
one or a few lines of differences for this reason, but other floating
381-
point differences on dissimilar architectures might cause many more
382-
differences. See the release notes below.
388+
should produce only one or a few lines of differences. You need
389+
not worry unless the random test always fails in repeated attempts.
390+
(On the other hand, if the random test is <emphasis>never</emphasis>
391+
reported to fail even in many trials of the regress tests, you
392+
probably <emphasis>should</emphasis> worry.)
383393
</Para>
384394

385395
</Sect2>
@@ -398,10 +408,10 @@ The runtime path is /usr/local/pgsql (other paths are possible).
398408
system using the <FileName>postgres5-1.02a5.tar.gz</FileName> source tree. It was compared
399409
with a file created on an I386 Solaris 2.4 system and the differences
400410
were only in the floating point polygons in the 3rd digit to the right
401-
of the decimal point. (see below)
411+
of the decimal point.
402412

403413
The original <FileName>sample.regress.out</FileName> file was from the postgres-1.01 release
404-
constructed by Jolly Chen and is included here for reference. It may
414+
constructed by Jolly Chen. It may
405415
have been created on a DEC ALPHA machine as the <FileName>Makefile.global</FileName>
406416
in the postgres-1.01 release has PORTNAME=alpha.
407417
</Para>

0 commit comments

Comments
 (0)