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

Commit 2128c52

Browse files
committed
Update regression testing instructions.
This documentation never got the word about the existence of check-world or installcheck-world. Revise to recommend use of those, and document all the subsidiary test suites. Do some minor wordsmithing elsewhere, too. In passing, remove markup related to generation of plain-text regression test instructions, since we don't do that anymore. Back-patch to 9.1 where check-world was added. (installcheck-world exists in 9.0; but since check-world doesn't, this patch would need additional work to cover that branch, and it doesn't seem worth the effort.)
1 parent dcbf397 commit 2128c52

File tree

1 file changed

+138
-69
lines changed

1 file changed

+138
-69
lines changed

doc/src/sgml/regress.sgml

+138-69
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<quote>sequential</quote> mode for running the tests. The
2929
sequential method runs each test script alone, while the
3030
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
3232
interprocess communication and locking are working correctly.
3333
</para>
3434

@@ -43,9 +43,7 @@ make check
4343
</screen>
4444
in the top-level directory. (Or you can change to
4545
<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:
4947
<screen>
5048
<computeroutput>
5149
=======================
@@ -113,9 +111,9 @@ make MAX_CONNECTIONS=10 check
113111
<title>Running the Tests Against an Existing Installation</title>
114112

115113
<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">),
117115
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:
119117
<screen>
120118
make installcheck
121119
</screen>
@@ -128,82 +126,94 @@ make installcheck-parallel
128126
<envar>PGPORT</envar> environment variables. The tests will be run in a
129127
database named <literal>regression</>; any existing database by this name
130128
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>.
155131
</para>
156132
</sect2>
157133

158134
<sect2>
159-
<title>Testing Hot Standby</title>
135+
<title>Additional Test Suites</title>
160136

161137
<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.
169143
</para>
170144

171145
<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:
173149
<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
188152
</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</>.
189160
</para>
190161

191162
<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.
195168
</para>
196169

197170
<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</>.
199209
</para>
200210
</sect2>
201211

202212
<sect2>
203213
<title>Locale and Encoding</title>
204214

205215
<para>
206-
By default, the tests against a temporary installation use the
216+
By default, tests using a temporary installation use the
207217
locale defined in the current environment and the corresponding
208218
database encoding as determined by <command>initdb</command>. It
209219
can be useful to test different locales by setting the appropriate
@@ -236,16 +246,17 @@ make check LANG=C ENCODING=EUC_JP
236246
</para>
237247

238248
<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.
241252
</para>
242253
</sect2>
243254

244255
<sect2>
245256
<title>Extra Tests</title>
246257

247258
<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
249260
run by default, because they might be platform-dependent or take a
250261
very long time to run. You can run these or other extra test
251262
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
261272
platforms, and only when run in a database that uses UTF-8 encoding.
262273
</para>
263274
</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>
264321
</sect1>
265322

266323
<sect1 id="regress-evaluation">
@@ -289,7 +346,14 @@ make check EXTRA_TESTS=collate.linux.utf8 LANG=en_US.utf8
289346
file against the reference outputs stored in the
290347
<filename>src/test/regress/expected</filename> directory. Any
291348
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
293357
like the <command>diff</command> options that are used by default, set the
294358
environment variable <envar>PG_REGRESS_DIFF_OPTS</envar>, for
295359
instance <literal>PG_REGRESS_DIFF_OPTS='-u'</literal>. (Or you
@@ -355,7 +419,7 @@ make check NO_LOCALE=1
355419
</para>
356420

357421
<para>
358-
In general, it is nevertheless advisable to try to run the
422+
In general, it is advisable to try to run the
359423
regression tests in the locale setup that is wanted for
360424
production use, as this will exercise the locale- and
361425
encoding-related code portions that will actually be used in
@@ -389,7 +453,7 @@ make check NO_LOCALE=1
389453
results involving mathematical functions of <type>double
390454
precision</type> columns have been observed. The <literal>float8</> and
391455
<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.
393457
Human eyeball comparison is needed to determine the real
394458
significance of these differences which are usually 10 places to
395459
the right of the decimal point.
@@ -451,22 +515,27 @@ exclusion of those that don't.
451515
If the <literal>errors</literal> test results in a server crash
452516
at the <literal>select infinite_recurse()</> command, it means that
453517
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
457519
can be fixed by running the server under a higher stack
458520
size limit (4MB is recommended with the default value of
459521
<varname>max_stack_depth</>). If you are unable to do that, an
460522
alternative is to reduce the value of <varname>max_stack_depth</>.
461523
</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>
462531
</sect2>
463532

464533
<sect2>
465534
<title>The <quote>random</quote> Test</title>
466535

467536
<para>
468537
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
470539
test to fail. Typing:
471540
<programlisting>
472541
diff results/random.out expected/random.out
@@ -484,7 +553,7 @@ diff results/random.out expected/random.out
484553
parameter settings could cause the tests to fail. For example, changing
485554
parameters such as <varname>enable_seqscan</varname> or
486555
<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</>.
488557
</para>
489558
</sect2>
490559
</sect1>

0 commit comments

Comments
 (0)