1- <!-- $PostgreSQL: pgsql/doc/src/sgml/regress.sgml,v 1.46 2005/03/07 02:00:28 tgl Exp $ -->
1+ <!-- $PostgreSQL: pgsql/doc/src/sgml/regress.sgml,v 1.47 2005/07/24 17:07:18 tgl Exp $ -->
22
33 <chapter id="regress">
44 <title id="regress-title">Regression Tests</title>
@@ -49,7 +49,7 @@ gmake check
4949<screen>
5050<computeroutput>
5151======================
52- All96 tests passed.
52+ All98 tests passed.
5353======================
5454</computeroutput>
5555</screen>
@@ -148,7 +148,7 @@ gmake installcheck-parallel
148148 <productname>PostgreSQL</productname> installations can
149149 <quote>fail</quote> some of these regression tests due to
150150 platform-specific artifacts such as varying floating-point representation
151- andtime zone support . The tests are currently evaluated using a simple
151+ andmessage wording . The tests are currently evaluated using a simple
152152 <command>diff</command> comparison against the outputs
153153 generated on a reference system, so the results are sensitive to
154154 small system differences. When a test is reported as
@@ -170,6 +170,14 @@ gmake installcheck-parallel
170170 can run <command>diff</command> yourself, if you prefer.)
171171 </para>
172172
173+ <para>
174+ If for some reason a particular platform generates a <quote>failure</>
175+ for a given test, but inspection of the output convinces you that
176+ the result is valid, you can add a new comparison file to silence
177+ the failure report in future test runs. See
178+ <xref linkend="regress-variant"> for details.
179+ </para>
180+
173181 <sect2>
174182 <title>Error message differences</title>
175183
@@ -194,54 +202,13 @@ gmake installcheck-parallel
194202 there may be differences due to sort order and follow-up
195203 failures. The regression test suite is set up to handle this
196204 problem by providing alternative result files that together are
197- known to handle a large number of locales. For example, for the
198- <literal>char</literal> test, the expected file
199- <filename>char.out</filename> handles the <literal>C</> and <literal>POSIX</> locales,
200- and the file <filename>char_1.out</filename> handles many other
201- locales. The regression test driver will automatically pick the
202- best file to match against when checking for success and for
203- computing failure differences. (This means that the regression
204- tests cannot detect whether the results are appropriate for the
205- configured locale. The tests will simply pick the one result
206- file that works best.)
207- </para>
208-
209- <para>
210- If for some reason the existing expected files do not cover some
211- locale, you can add a new file. The naming scheme is
212- <literal><replaceable>testname</>_<replaceable>digit</>.out</>.
213- The actual digit is not significant. Remember that the
214- regression test driver will consider all such files to be equally
215- valid test results. If the test results are platform-specific,
216- the technique described in <xref linkend="regress-platform">
217- should be used instead.
205+ known to handle a large number of locales.
218206 </para>
219207 </sect2>
220208
221209 <sect2>
222210 <title>Date and time differences</title>
223211
224- <para>
225- A few of the queries in the <filename>horology</filename> test will
226- fail if you run the test on the day of a daylight-saving time
227- changeover, or the day after one. These queries expect that
228- the intervals between midnight yesterday, midnight today and
229- midnight tomorrow are exactly twenty-four hours — which is wrong
230- if daylight-saving time went into or out of effect meanwhile.
231- </para>
232-
233- <note>
234- <para>
235- Because USA daylight-saving time rules are used, this problem always
236- occurs on the first Sunday of April, the last Sunday of October,
237- and their following Mondays, regardless of when daylight-saving time
238- is in effect where you live. Also note that the problem appears or
239- disappears at midnight Pacific time (UTC-7 or UTC-8), not midnight
240- your local time. Thus the failure may appear late on Saturday or
241- persist through much of Tuesday, depending on where you live.
242- </para>
243- </note>
244-
245212 <para>
246213 Most of the date and time results are dependent on the time zone
247214 environment. The reference files are generated for time zone
@@ -334,19 +301,26 @@ diff results/random.out expected/random.out
334301 </sect1>
335302
336303<!-- We might want to move the following section into the developer's guide. -->
337- <sect1 id="regress-platform">
338- <title>Platform-specific comparison files</title>
304+ <sect1 id="regress-variant">
305+ <title>Variant Comparison Files</title>
306+
307+ <para>
308+ Since some of the tests inherently produce environment-dependent
309+ results, we have provided ways to specify alternative <quote>expected</>
310+ result files. Each regression test can have several comparison files
311+ showing possible results on different platforms. There are two
312+ independent mechanisms for determining which comparison file is used
313+ for each test.
314+ </para>
339315
340316 <para>
341- Since some of the tests inherently produce platform-specific
342- results, we have provided a way to supply platform-specific result
343- comparison files. Frequently, the same variation applies to
344- multiple platforms; rather than supplying a separate comparison
345- file for every platform, there is a mapping file that defines
346- which comparison file to use. So, to eliminate bogus test
347- <quote>failures</quote> for a particular platform, you must choose
348- or make a variant result file, and then add a line to the mapping
349- file, which is <filename>src/test/regress/resultmap</filename>.
317+ The first mechanism allows comparison files to be selected for
318+ specific platforms. There is a mapping file,
319+ <filename>src/test/regress/resultmap</filename>, that defines
320+ which comparison file to use for each platform.
321+ To eliminate bogus test <quote>failures</quote> for a particular platform,
322+ you first choose or make a variant result file, and then add a line to the
323+ <filename>resultmap</filename> file.
350324 </para>
351325
352326 <para>
@@ -363,7 +337,7 @@ testname/platformpattern=comparisonfilename
363337 <literal>:gcc</literal> or <literal>:cc</literal>, depending on
364338 whether you use the GNU compiler or the system's native compiler
365339 (on systems where there is a difference). The comparison file
366- name is the name of the substitute result comparison file.
340+ name is thebase name of the substitute result comparison file.
367341 </para>
368342
369343 <para>
@@ -384,6 +358,41 @@ float8/i.86-.*-openbsd=float8-small-is-zero
384358 in <filename>resultmap</> select the variant comparison file for other
385359 platforms where it's appropriate.
386360 </para>
361+
362+ <para>
363+ The second selection mechanism for variant comparison files is
364+ much more automatic: it simply uses the <quote>best match</> among
365+ several supplied comparison files. The regression test driver
366+ script considers both the standard comparison file for a test,
367+ <literal><replaceable>testname</>.out</>, and variant files named
368+ <literal><replaceable>testname</>_<replaceable>digit</>.out</>
369+ (where the <replaceable>digit</> is any single digit
370+ <literal>0</>-<literal>9</>). If any such file is an exact match,
371+ the test is considered to pass; otherwise, the one that generates
372+ the shortest diff is used to create the failure report. (If
373+ <filename>resultmap</filename> includes an entry for the particular
374+ test, then the base <replaceable>testname</> is the substitute
375+ name given in <filename>resultmap</filename>.)
376+ </para>
377+
378+ <para>
379+ For example, for the <literal>char</literal> test, the comparison file
380+ <filename>char.out</filename> contains results that are expected
381+ in the <literal>C</> and <literal>POSIX</> locales, while
382+ the file <filename>char_1.out</filename> contains results sorted as
383+ they appear in many other locales.
384+ </para>
385+
386+ <para>
387+ The best-match mechanism was devised to cope with locale-dependent
388+ results, but it can be used in any situation where the test results
389+ cannot be predicted easily from the platform name alone. A limitation of
390+ this mechanism is that the test driver cannot tell which variant is
391+ actually <quote>correct</> for the current environment; it will just pick
392+ the variant that seems to work best. Therefore it is safest to use this
393+ mechanism only for variant results that you are willing to consider
394+ equally valid in all contexts.
395+ </para>
387396
388397 </sect1>
389398