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 @@ gmake 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 @@ gmake 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
gmake installcheck
121
119
</screen>
@@ -125,81 +123,97 @@ gmake installcheck-parallel
125
123
</screen>
126
124
The tests will expect to contact the server at the local host and the
127
125
default port number, unless directed otherwise by <envar>PGHOST</envar> and
128
- <envar>PGPORT</envar> environment variables.
129
- </para>
130
-
131
- <para>
132
- The source distribution also contains regression tests for the optional
133
- procedural languages and for some of the <filename>contrib</> modules.
134
- At present, these tests can be used only against an already-installed
135
- server. To run the tests for all procedural languages that have been
136
- built and installed, change to the <filename>src/pl</> directory of the
137
- build tree and type:
138
- <screen>
139
- gmake installcheck
140
- </screen>
141
- You can also do this in any of the subdirectories of <filename>src/pl</>
142
- to run tests for just one procedural language. To run the tests for all
143
- <filename>contrib</> modules that have them, change to the
144
- <filename>contrib</> directory of the build tree and type:
145
- <screen>
146
- gmake installcheck
147
- </screen>
148
- The <filename>contrib</> modules must have been built and installed first.
149
- You can also do this in a subdirectory of <filename>contrib</> to run
150
- the tests for just one module.
126
+ <envar>PGPORT</envar> environment variables. The tests will be run in a
127
+ database named <literal>regression</>; any existing database by this name
128
+ 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>.
151
131
</para>
152
132
</sect2>
153
133
154
134
<sect2>
155
- <title>Testing Hot Standby </title>
135
+ <title>Additional Test Suites </title>
156
136
157
137
<para>
158
- The source distribution also contains regression tests of the static
159
- behaviour of Hot Standby. These tests require a running primary server
160
- and a running standby server that is accepting new WAL changes from the
161
- primary using either file-based log shipping or streaming replication.
162
- Those servers are not automatically created for you, nor is the setup
163
- documented here. Please check the various sections of the documentation already
164
- devoted to the required commands and related issues.
138
+ The <literal>gmake check</> and <literal>gmake 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.
165
143
</para>
166
144
167
145
<para>
168
- First create a database called "regression" on the primary.
169
- <screen>
170
- psql -h primary -c "CREATE DATABASE regression"
171
- </screen>
172
- Next, run a preparatory script on the primary in the regression database:
173
- <filename>src/test/regress/sql/hs_primary_setup.sql</filename>, and
174
- allow for the changes to propagate to the standby, for example
175
- <screen>
176
- psql -h primary -f src/test/regress/sql/hs_primary_setup.sql regression
177
- </screen>
178
- Now confirm that the default connection for the tester is the standby
179
- server under test and then run the <literal>standbycheck</> target from the regression
180
- directory:
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:
181
149
<screen>
182
- cd src/test/regress
183
- gmake standbycheck
150
+ gmake check-world
151
+ gmake installcheck-world
184
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>gmake check</> and <literal>gmake installcheck</>. Other
156
+ considerations are the same as previously explained for each method.
157
+ Note that <literal>gmake 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>gmake installcheck-world</>.
185
160
</para>
186
161
187
162
<para>
188
- Some extreme behaviours can also be generated on the primary using the
189
- script: <filename>src/test/regress/sql/hs_primary_extremes.sql</filename>
190
- to allow the behaviour of the standby to be tested.
163
+ Alternatively, you can run individual test suites by typing
164
+ <literal>gmake check</> or <literal>gmake installcheck</> in the appropriate
165
+ subdirectory of the build tree. Keep in mind that <literal>gmake
166
+ installcheck</> assumes you've installed the relevant module(s), not
167
+ only the core server.
191
168
</para>
192
169
193
170
<para>
194
- 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</>.
195
209
</para>
196
210
</sect2>
197
211
198
212
<sect2>
199
213
<title>Locale and Encoding</title>
200
214
201
215
<para>
202
- By default, the tests against a temporary installation use the
216
+ By default, tests using a temporary installation use the
203
217
locale defined in the current environment and the corresponding
204
218
database encoding as determined by <command>initdb</command>. It
205
219
can be useful to test different locales by setting the appropriate
@@ -232,16 +246,17 @@ gmake check LANG=C ENCODING=EUC_JP
232
246
</para>
233
247
234
248
<para>
235
- The encoding can be set for tests against a temporary or an
236
- 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.
237
252
</para>
238
253
</sect2>
239
254
240
255
<sect2>
241
256
<title>Extra Tests</title>
242
257
243
258
<para>
244
- 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
245
260
run by default, because they might be platform-dependent or take a
246
261
very long time to run. You can run these or other extra test
247
262
files by setting the variable <envar>EXTRA_TESTS</envar>. For
@@ -257,6 +272,52 @@ gmake check EXTRA_TESTS=collate.linux.utf8 LANG=en_US.utf8
257
272
platforms, and only when run in a database that uses UTF-8 encoding.
258
273
</para>
259
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>gmake standbycheck</> in the regression directory:
309
+ <screen>
310
+ cd src/test/regress
311
+ gmake 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>
260
321
</sect1>
261
322
262
323
<sect1 id="regress-evaluation">
@@ -285,8 +346,10 @@ gmake check EXTRA_TESTS=collate.linux.utf8 LANG=en_US.utf8
285
346
file against the reference outputs stored in the
286
347
<filename>src/test/regress/expected</filename> directory. Any
287
348
differences are saved for your inspection in
288
- <filename>src/test/regress/regression.diffs</filename>. (Or you
289
- can run <command>diff</command> yourself, if you prefer.)
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</>.)
290
353
</para>
291
354
292
355
<para>
@@ -328,7 +391,7 @@ gmake check EXTRA_TESTS=collate.linux.utf8 LANG=en_US.utf8
328
391
To run the tests in a different locale when using the
329
392
temporary-installation method, pass the appropriate
330
393
locale-related environment variables on
331
- the <command>make </command> command line, for example:
394
+ the <command>gmake </command> command line, for example:
332
395
<programlisting>
333
396
gmake check LANG=de_DE.utf8
334
397
</programlisting>
@@ -348,7 +411,7 @@ gmake check NO_LOCALE=1
348
411
</para>
349
412
350
413
<para>
351
- In general, it is nevertheless advisable to try to run the
414
+ In general, it is advisable to try to run the
352
415
regression tests in the locale setup that is wanted for
353
416
production use, as this will exercise the locale- and
354
417
encoding-related code portions that will actually be used in
@@ -382,7 +445,7 @@ gmake check NO_LOCALE=1
382
445
results involving mathematical functions of <type>double
383
446
precision</type> columns have been observed. The <literal>float8</> and
384
447
<literal>geometry</> tests are particularly prone to small differences
385
- across platforms, or even with different compiler optimization setting .
448
+ across platforms, or even with different compiler optimization settings .
386
449
Human eyeball comparison is needed to determine the real
387
450
significance of these differences which are usually 10 places to
388
451
the right of the decimal point.
@@ -444,22 +507,27 @@ exclusion of those that don't.
444
507
If the <literal>errors</literal> test results in a server crash
445
508
at the <literal>select infinite_recurse()</> command, it means that
446
509
the platform's limit on process stack size is smaller than the
447
- <![%standalone-ignore;[<xref linkend="guc-max-stack-depth">]]>
448
- <![%standalone-include;[<literal>max_stack_depth</literal>]]>
449
- parameter indicates. This
510
+ <xref linkend="guc-max-stack-depth"> parameter indicates. This
450
511
can be fixed by running the server under a higher stack
451
512
size limit (4MB is recommended with the default value of
452
513
<varname>max_stack_depth</>). If you are unable to do that, an
453
514
alternative is to reduce the value of <varname>max_stack_depth</>.
454
515
</para>
516
+
517
+ <para>
518
+ On platforms supporting <function>getrlimit()</>, the server should
519
+ automatically choose a safe value of <varname>max_stack_depth</>;
520
+ so unless you've manually overridden this setting, a failure of this
521
+ kind is a reportable bug.
522
+ </para>
455
523
</sect2>
456
524
457
525
<sect2>
458
526
<title>The <quote>random</quote> Test</title>
459
527
460
528
<para>
461
529
The <literal>random</literal> test script is intended to produce
462
- random results. In rare cases, this causes the random regression
530
+ random results. In very rare cases, this causes that regression
463
531
test to fail. Typing:
464
532
<programlisting>
465
533
diff results/random.out expected/random.out
@@ -468,6 +536,18 @@ diff results/random.out expected/random.out
468
536
not worry unless the random test fails repeatedly.
469
537
</para>
470
538
</sect2>
539
+
540
+ <sect2>
541
+ <title>Configuration Parameters</title>
542
+
543
+ <para>
544
+ When running the tests against an existing installation, some non-default
545
+ parameter settings could cause the tests to fail. For example, changing
546
+ parameters such as <varname>enable_seqscan</varname> or
547
+ <varname>enable_indexscan</varname> could cause plan changes that would
548
+ affect the results of tests that use <command>EXPLAIN</>.
549
+ </para>
550
+ </sect2>
471
551
</sect1>
472
552
473
553
<!-- We might want to move the following section into the developer's guide. -->
0 commit comments