28
28
<quote>sequential</quote> mode for running the tests. The
29
29
sequential method runs each test script alone, while the
30
30
parallel method starts up multiple server processes to run groups
31
- of tests in parallel. Parallel testing gives confidence that
31
+ of tests in parallel. Parallel testing adds confidence that
32
32
interprocess communication and locking are working correctly.
33
33
</para>
34
34
@@ -43,9 +43,7 @@ make check
43
43
</screen>
44
44
in the top-level directory. (Or you can change to
45
45
<filename>src/test/regress</filename> and run the command there.)
46
- This will first build several auxiliary files, such as
47
- sample user-defined trigger functions, and then run the test driver
48
- script. At the end you should see something like:
46
+ At the end you should see something like:
49
47
<screen>
50
48
<computeroutput>
51
49
=======================
@@ -113,9 +111,9 @@ make MAX_CONNECTIONS=10 check
113
111
<title>Running the Tests Against an Existing Installation</title>
114
112
115
113
<para>
116
- To run the tests after installation<![%standalone-ignore;[ (see <xref linkend="installation">)]]> ,
114
+ To run the tests after installation (see <xref linkend="installation">),
117
115
initialize a data area and start the
118
- server, <![%standalone-ignore;[ as explained in <xref linkend="runtime">, ]]> then type:
116
+ server as explained in <xref linkend="runtime">, then type:
119
117
<screen>
120
118
make installcheck
121
119
</screen>
@@ -128,82 +126,94 @@ make installcheck-parallel
128
126
<envar>PGPORT</envar> environment variables. The tests will be run in a
129
127
database named <literal>regression</>; any existing database by this name
130
128
will be dropped.
131
- </para>
132
-
133
- <para>
134
- The source distribution also contains regression tests for the optional
135
- procedural languages and for some of the <filename>contrib</> modules.
136
- At present, these tests can be used only against an already-installed
137
- server. To run the tests for all procedural languages that have been
138
- built and installed, change to the <filename>src/pl</> directory of the
139
- build tree and type:
140
- <screen>
141
- make installcheck
142
- </screen>
143
- You can also do this in any of the subdirectories of <filename>src/pl</>
144
- to run tests for just one procedural language. To run the tests for all
145
- <filename>contrib</> modules that have them, change to the
146
- <filename>contrib</> directory of the build tree and type:
147
- <screen>
148
- make installcheck
149
- </screen>
150
- The <filename>contrib</> modules must have been built and installed first.
151
- You can also do this in a subdirectory of <filename>contrib</> to run
152
- the tests for just one module. Tests of <literal>contrib</> modules will
153
- be run in a database named <literal>contrib_regression</>; any existing
154
- database by this name will be dropped.
129
+ The tests will also transiently create some cluster-wide objects, such as
130
+ user identities named <literal>regressuser<replaceable>N</></literal>.
155
131
</para>
156
132
</sect2>
157
133
158
134
<sect2>
159
- <title>Testing Hot Standby </title>
135
+ <title>Additional Test Suites </title>
160
136
161
137
<para>
162
- The source distribution also contains regression tests of the static
163
- behavior of Hot Standby. These tests require a running primary server
164
- and a running standby server that is accepting new WAL changes from the
165
- primary using either file-based log shipping or streaming replication.
166
- Those servers are not automatically created for you, nor is the setup
167
- documented here. Please check the various sections of the documentation already
168
- devoted to the required commands and related issues.
138
+ The <literal>make check</> and <literal>make installcheck</> commands
139
+ run only the <quote>core</> regression tests, which test built-in
140
+ functionality of the <productname>PostgreSQL</> server. The source
141
+ distribution also contains additional test suites, most of them having
142
+ to do with add-on functionality such as optional procedural languages.
169
143
</para>
170
144
171
145
<para>
172
- First create a database called "regression" on the primary.
146
+ To run all test suites applicable to the modules that have been selected
147
+ to be built, including the core tests, type one of these commands at the
148
+ top of the build tree:
173
149
<screen>
174
- psql -h primary -c "CREATE DATABASE regression"
175
- </screen>
176
- Next, run a preparatory script on the primary in the regression database:
177
- <filename>src/test/regress/sql/hs_primary_setup.sql</filename>, and
178
- allow for the changes to propagate to the standby, for example
179
- <screen>
180
- psql -h primary -f src/test/regress/sql/hs_primary_setup.sql regression
181
- </screen>
182
- Now confirm that the default connection for the tester is the standby
183
- server under test and then run the <literal>standbycheck</> target from the regression
184
- directory:
185
- <screen>
186
- cd src/test/regress
187
- make standbycheck
150
+ make check-world
151
+ make installcheck-world
188
152
</screen>
153
+ These commands run the tests using temporary servers or an
154
+ already-installed server, respectively, just as previously explained
155
+ for <literal>make check</> and <literal>make installcheck</>. Other
156
+ considerations are the same as previously explained for each method.
157
+ Note that <literal>make check-world</> builds a separate temporary
158
+ installation tree for each tested module, so it requires a great deal
159
+ more time and disk space than <literal>make installcheck-world</>.
189
160
</para>
190
161
191
162
<para>
192
- Some extreme behaviors can also be generated on the primary using the
193
- script: <filename>src/test/regress/sql/hs_primary_extremes.sql</filename>
194
- to allow the behavior of the standby to be tested.
163
+ Alternatively, you can run individual test suites by typing
164
+ <literal>make check</> or <literal>make installcheck</> in the appropriate
165
+ subdirectory of the build tree. Keep in mind that <literal>make
166
+ installcheck</> assumes you've installed the relevant module(s), not
167
+ only the core server.
195
168
</para>
196
169
197
170
<para>
198
- Additional automated testing may be available in later releases.
171
+ The additional tests that can be invoked this way include:
172
+ </para>
173
+
174
+ <itemizedlist>
175
+ <listitem>
176
+ <para>
177
+ Regression tests for optional procedural languages (other than
178
+ <application>PL/pgSQL</>, which is tested by the core tests).
179
+ These are located under <filename>src/pl</>.
180
+ </para>
181
+ </listitem>
182
+ <listitem>
183
+ <para>
184
+ Regression tests for <filename>contrib</> modules,
185
+ located under <filename>contrib</>.
186
+ Not all <filename>contrib</> modules have tests.
187
+ </para>
188
+ </listitem>
189
+ <listitem>
190
+ <para>
191
+ Regression tests for the ECPG interface library,
192
+ located in <filename>src/interfaces/ecpg/test</>.
193
+ </para>
194
+ </listitem>
195
+ <listitem>
196
+ <para>
197
+ Tests stressing behavior of concurrent sessions,
198
+ located in <filename>src/test/isolation</>.
199
+ </para>
200
+ </listitem>
201
+ </itemizedlist>
202
+
203
+ <para>
204
+ When using <literal>installcheck</> mode, these tests will destroy any
205
+ existing databases named <literal>pl_regression</>,
206
+ <literal>contrib_regression</>, <literal>isolationtest</>,
207
+ <literal>regress1</>, or <literal>connectdb</>, as well as
208
+ <literal>regression</>.
199
209
</para>
200
210
</sect2>
201
211
202
212
<sect2>
203
213
<title>Locale and Encoding</title>
204
214
205
215
<para>
206
- By default, the tests against a temporary installation use the
216
+ By default, tests using a temporary installation use the
207
217
locale defined in the current environment and the corresponding
208
218
database encoding as determined by <command>initdb</command>. It
209
219
can be useful to test different locales by setting the appropriate
@@ -236,16 +246,17 @@ make check LANG=C ENCODING=EUC_JP
236
246
</para>
237
247
238
248
<para>
239
- The encoding can be set for tests against a temporary or an
240
- existing installation.
249
+ The database encoding can be set for tests against either a temporary or
250
+ an existing installation, though in the latter case it must be
251
+ compatible with the installation's locale.
241
252
</para>
242
253
</sect2>
243
254
244
255
<sect2>
245
256
<title>Extra Tests</title>
246
257
247
258
<para>
248
- The regression test suite contains a few test files that are not
259
+ The core regression test suite contains a few test files that are not
249
260
run by default, because they might be platform-dependent or take a
250
261
very long time to run. You can run these or other extra test
251
262
files by setting the variable <envar>EXTRA_TESTS</envar>. For
@@ -261,6 +272,52 @@ make check EXTRA_TESTS=collate.linux.utf8 LANG=en_US.utf8
261
272
platforms, and only when run in a database that uses UTF-8 encoding.
262
273
</para>
263
274
</sect2>
275
+
276
+ <sect2>
277
+ <title>Testing Hot Standby</title>
278
+
279
+ <para>
280
+ The source distribution also contains regression tests for the static
281
+ behavior of Hot Standby. These tests require a running primary server
282
+ and a running standby server that is accepting new WAL changes from the
283
+ primary (using either file-based log shipping or streaming replication).
284
+ Those servers are not automatically created for you, nor is replication
285
+ setup documented here. Please check the various sections of the
286
+ documentation devoted to the required commands and related issues.
287
+ </para>
288
+
289
+ <para>
290
+ To run the Hot Standby tests, first create a database
291
+ called <literal>regression</> on the primary:
292
+ <screen>
293
+ psql -h primary -c "CREATE DATABASE regression"
294
+ </screen>
295
+ Next, run the preparatory script
296
+ <filename>src/test/regress/sql/hs_primary_setup.sql</filename>
297
+ on the primary in the regression database, for example:
298
+ <screen>
299
+ psql -h primary -f src/test/regress/sql/hs_primary_setup.sql regression
300
+ </screen>
301
+ Allow these changes to propagate to the standby.
302
+ </para>
303
+
304
+ <para>
305
+ Now arrange for the default database connection to be to the standby
306
+ server under test (for example, by setting the <envar>PGHOST</envar> and
307
+ <envar>PGPORT</envar> environment variables).
308
+ Finally, run <literal>make standbycheck</> in the regression directory:
309
+ <screen>
310
+ cd src/test/regress
311
+ make standbycheck
312
+ </screen>
313
+ </para>
314
+
315
+ <para>
316
+ Some extreme behaviors can also be generated on the primary using the
317
+ script <filename>src/test/regress/sql/hs_primary_extremes.sql</filename>
318
+ to allow the behavior of the standby to be tested.
319
+ </para>
320
+ </sect2>
264
321
</sect1>
265
322
266
323
<sect1 id="regress-evaluation">
@@ -289,7 +346,14 @@ make check EXTRA_TESTS=collate.linux.utf8 LANG=en_US.utf8
289
346
file against the reference outputs stored in the
290
347
<filename>src/test/regress/expected</filename> directory. Any
291
348
differences are saved for your inspection in
292
- <filename>src/test/regress/regression.diffs</filename>. If you don't
349
+ <filename>src/test/regress/regression.diffs</filename>.
350
+ (When running a test suite other than the core tests, these files
351
+ of course appear in the relevant subdirectory,
352
+ not <filename>src/test/regress</>.)
353
+ </para>
354
+
355
+ <para>
356
+ If you don't
293
357
like the <command>diff</command> options that are used by default, set the
294
358
environment variable <envar>PG_REGRESS_DIFF_OPTS</envar>, for
295
359
instance <literal>PG_REGRESS_DIFF_OPTS='-u'</literal>. (Or you
@@ -355,7 +419,7 @@ make check NO_LOCALE=1
355
419
</para>
356
420
357
421
<para>
358
- In general, it is nevertheless advisable to try to run the
422
+ In general, it is advisable to try to run the
359
423
regression tests in the locale setup that is wanted for
360
424
production use, as this will exercise the locale- and
361
425
encoding-related code portions that will actually be used in
@@ -389,7 +453,7 @@ make check NO_LOCALE=1
389
453
results involving mathematical functions of <type>double
390
454
precision</type> columns have been observed. The <literal>float8</> and
391
455
<literal>geometry</> tests are particularly prone to small differences
392
- across platforms, or even with different compiler optimization setting .
456
+ across platforms, or even with different compiler optimization settings .
393
457
Human eyeball comparison is needed to determine the real
394
458
significance of these differences which are usually 10 places to
395
459
the right of the decimal point.
@@ -451,22 +515,27 @@ exclusion of those that don't.
451
515
If the <literal>errors</literal> test results in a server crash
452
516
at the <literal>select infinite_recurse()</> command, it means that
453
517
the platform's limit on process stack size is smaller than the
454
- <![%standalone-ignore;[<xref linkend="guc-max-stack-depth">]]>
455
- <![%standalone-include;[<literal>max_stack_depth</literal>]]>
456
- parameter indicates. This
518
+ <xref linkend="guc-max-stack-depth"> parameter indicates. This
457
519
can be fixed by running the server under a higher stack
458
520
size limit (4MB is recommended with the default value of
459
521
<varname>max_stack_depth</>). If you are unable to do that, an
460
522
alternative is to reduce the value of <varname>max_stack_depth</>.
461
523
</para>
524
+
525
+ <para>
526
+ On platforms supporting <function>getrlimit()</>, the server should
527
+ automatically choose a safe value of <varname>max_stack_depth</>;
528
+ so unless you've manually overridden this setting, a failure of this
529
+ kind is a reportable bug.
530
+ </para>
462
531
</sect2>
463
532
464
533
<sect2>
465
534
<title>The <quote>random</quote> Test</title>
466
535
467
536
<para>
468
537
The <literal>random</literal> test script is intended to produce
469
- random results. In rare cases, this causes the random regression
538
+ random results. In very rare cases, this causes that regression
470
539
test to fail. Typing:
471
540
<programlisting>
472
541
diff results/random.out expected/random.out
@@ -484,7 +553,7 @@ diff results/random.out expected/random.out
484
553
parameter settings could cause the tests to fail. For example, changing
485
554
parameters such as <varname>enable_seqscan</varname> or
486
555
<varname>enable_indexscan</varname> could cause plan changes that would
487
- affect the results of tests which use <command>EXPLAIN</>.
556
+ affect the results of tests that use <command>EXPLAIN</>.
488
557
</para>
489
558
</sect2>
490
559
</sect1>
0 commit comments