1
1
<Chapter Id="regress">
2
- <Title>Regression Test</Title>
2
+ <Title id="regress-title" >Regression Test</Title>
3
3
4
4
<Abstract>
5
5
<Para>
@@ -13,21 +13,40 @@ Regression test instructions and analysis.
13
13
operations as well as the extended capabilities of PostgreSQL.
14
14
</Para>
15
15
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
+
16
41
<Para>
17
42
The regression tests were originally developed by Jolly Chen and Andrew Yu,
18
43
and were extensively revised/repackaged by Marc Fournier and Thomas Lockhart.
19
44
From <ProductName>PostgreSQL</ProductName> v6.1 onward
20
45
the regression tests are current for every official release.
21
46
</Para>
22
47
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>
31
50
32
51
<Para>
33
52
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
79
</ItemizedList>
61
80
</Para>
62
81
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
-
74
82
<Para>
75
83
Normally, the regression tests should be run as the postgres user since
76
84
the 'src/test/regress' directory and sub-directories are owned by the
77
85
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.
79
87
</Para>
80
88
81
89
<Para>
@@ -131,6 +139,8 @@ The runtime path is /usr/local/pgsql (other paths are possible).
131
139
132
140
results/ .. .out files that contain what the results *actually* look
133
141
like. Also used as temporary storage for table copy testing.
142
+
143
+ tmp_check/ temporary installation created by parallel testing script.
134
144
</ProgramListing>
135
145
</Para>
136
146
</Sect1>
@@ -144,39 +154,48 @@ The runtime path is /usr/local/pgsql (other paths are possible).
144
154
like <FileName>ps</FileName> and <FileName>tar</FileName> vary wildly on what options you should use on each
145
155
platform. <Emphasis>Use common sense</Emphasis> before typing in these commands.
146
156
</Para>
147
-
148
- <Para>
149
- For a fresh install or upgrading from previous releases of
150
- <ProductName>Postgres</ProductName>:
151
- </Para>
152
157
153
158
<Procedure>
154
- <Title><ProductName>Postgres</ProductName> Regression Configuration </Title>
155
-
159
+ <Title><ProductName>Postgres</ProductName> Regression Test </Title>
160
+
156
161
<Step Performance="required">
157
162
<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.
161
178
</Para>
162
-
179
+ </step>
180
+
181
+ <Step Performance="optional">
163
182
<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
166
187
<ProgramListing>
167
188
postmaster
168
189
</ProgramListing>
169
-
170
190
or start the postmaster daemon running in the background by typing
171
191
<ProgramListing>
172
192
cd
173
193
nohup postmaster > regress.log 2>&1 &
174
194
</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.
180
199
181
200
<Note>
182
201
<Para>
@@ -186,68 +205,54 @@ The runtime path is /usr/local/pgsql (other paths are possible).
186
205
</Para>
187
206
</Step>
188
207
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
-
206
208
<Step Performance="required">
207
209
<Para>
208
- Build the regression test. Type
210
+ Run the regression tests. For a sequential test, type
209
211
<ProgramListing>
210
212
cd /usr/src/pgsql/src/test/regress
211
- gmake all
213
+ gmake runtest
212
214
</ProgramListing>
213
- </Para>
214
- </Step>
215
-
216
- <Step Performance="required">
217
- <Para>
218
- Run the regression tests. Type
215
+ For a parallel test, type
219
216
<ProgramListing>
220
217
cd /usr/src/pgsql/src/test/regress
221
- gmake runtest
218
+ gmake runcheck
222
219
</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).
223
227
</Para>
224
228
</Step>
225
229
226
230
<Step Performance="required">
227
231
<Para>
228
-
229
232
You should get on the screen (and also written to file ./regress.out)
230
233
a series of statements stating which tests passed and which tests
231
234
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.
239
241
</Para>
240
242
</Step>
241
243
242
244
<Step Performance="required">
243
245
<Para>
244
246
After running the tests and examining the results, type
245
247
<ProgramListing>
246
- dropdb regression
247
248
cd /usr/src/pgsql/src/test/regress
248
249
gmake clean
249
250
</ProgramListing>
250
251
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>
251
256
</Para>
252
257
</Step>
253
258
</procedure>
@@ -257,10 +262,14 @@ The runtime path is /usr/local/pgsql (other paths are possible).
257
262
<Title>Regression Analysis</Title>
258
263
259
264
<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.)
264
273
</Para>
265
274
266
275
<Para>
@@ -354,7 +363,7 @@ The runtime path is /usr/local/pgsql (other paths are possible).
354
363
355
364
When comparing the results from different platforms, differences occur
356
365
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 :
358
367
359
368
<ProgramListing>
360
369
QUERY: SELECT * from street;
@@ -368,18 +377,19 @@ The runtime path is /usr/local/pgsql (other paths are possible).
368
377
<Title>Random differences</Title>
369
378
370
379
<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).
374
384
Typing
375
385
<ProgramListing>
376
386
diff results/random.out expected/random.out
377
387
</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.)
383
393
</Para>
384
394
385
395
</Sect2>
@@ -398,10 +408,10 @@ The runtime path is /usr/local/pgsql (other paths are possible).
398
408
system using the <FileName>postgres5-1.02a5.tar.gz</FileName> source tree. It was compared
399
409
with a file created on an I386 Solaris 2.4 system and the differences
400
410
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.
402
412
403
413
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
405
415
have been created on a DEC ALPHA machine as the <FileName>Makefile.global</FileName>
406
416
in the postgres-1.01 release has PORTNAME=alpha.
407
417
</Para>
0 commit comments