1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>27.3.Variant Comparison Files</title>
<link rel="stylesheet" href="stylesheet.css" type="text/css">
<link rev="made" href="pgsql-docs@postgresql.org">
<meta name="generator" content="DocBook XSL Stylesheets V1.70.0">
<link rel="start" href="index.html" title="PostgreSQL 8.1.4 Documentation">
<link rel="up" href="regress.html" title="Chapter27.Regression Tests">
<link rel="prev" href="regress-evaluation.html" title="27.2.Test Evaluation">
<link rel="next" href="client-interfaces.html" title="PartIV.Client Interfaces">
<link rel="copyright" href="ln-legalnotice.html" title="Legal Notice">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="sect1" lang="en">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="regress-variant"></a>27.3.Variant Comparison Files</h2></div></div></div>
<p> Since some of the tests inherently produce environment-dependent
results, we have provided ways to specify alternative “<span class="quote">expected</span>”
result files. Each regression test can have several comparison files
showing possible results on different platforms. There are two
independent mechanisms for determining which comparison file is used
for each test.
</p>
<p> The first mechanism allows comparison files to be selected for
specific platforms. There is a mapping file,
<code class="filename">src/test/regress/resultmap</code>, that defines
which comparison file to use for each platform.
To eliminate bogus test “<span class="quote">failures</span>” for a particular platform,
you first choose or make a variant result file, and then add a line to the
<code class="filename">resultmap</code> file.
</p>
<p> Each line in the mapping file is of the form
</p>
<pre class="synopsis">testname/platformpattern=comparisonfilename</pre>
<p>
The test name is just the name of the particular regression test
module. The platform pattern is a pattern in the style of the Unix
tool <code class="command">expr</code> (that is, a regular expression with an implicit
<code class="literal">^</code> anchor
at the start). It is matched against the platform name as printed
by <code class="command">config.guess</code> followed by
<code class="literal">:gcc</code> or <code class="literal">:cc</code>, depending on
whether you use the GNU compiler or the system's native compiler
(on systems where there is a difference). The comparison file
name is the base name of the substitute result comparison file.
</p>
<p> For example: some systems interpret very small floating-point values
as zero, rather than reporting an underflow error. This causes a
few differences in the <code class="filename">float8</code> regression test.
Therefore, we provide a variant comparison file,
<code class="filename">float8-small-is-zero.out</code>, which includes
the results to be expected on these systems. To silence the bogus
“<span class="quote">failure</span>” message on <span class="systemitem">OpenBSD</span>
platforms, <code class="filename">resultmap</code> includes
</p>
<pre class="programlisting">float8/i.86-.*-openbsd=float8-small-is-zero</pre>
<p>
which will trigger on any machine for which the output of
<code class="command">config.guess</code> matches <code class="literal">i.86-.*-openbsd</code>.
Other lines
in <code class="filename">resultmap</code> select the variant comparison file for other
platforms where it's appropriate.
</p>
<p> The second selection mechanism for variant comparison files is
much more automatic: it simply uses the “<span class="quote">best match</span>” among
several supplied comparison files. The regression test driver
script considers both the standard comparison file for a test,
<code class="literal"><em class="replaceable"><code>testname</code></em>.out</code>, and variant files named
<code class="literal"><em class="replaceable"><code>testname</code></em>_<em class="replaceable"><code>digit</code></em>.out</code>
(where the <em class="replaceable"><code>digit</code></em> is any single digit
<code class="literal">0</code>-<code class="literal">9</code>). If any such file is an exact match,
the test is considered to pass; otherwise, the one that generates
the shortest diff is used to create the failure report. (If
<code class="filename">resultmap</code> includes an entry for the particular
test, then the base <em class="replaceable"><code>testname</code></em> is the substitute
name given in <code class="filename">resultmap</code>.)
</p>
<p> For example, for the <code class="literal">char</code> test, the comparison file
<code class="filename">char.out</code> contains results that are expected
in the <code class="literal">C</code> and <code class="literal">POSIX</code> locales, while
the file <code class="filename">char_1.out</code> contains results sorted as
they appear in many other locales.
</p>
<p> The best-match mechanism was devised to cope with locale-dependent
results, but it can be used in any situation where the test results
cannot be predicted easily from the platform name alone. A limitation of
this mechanism is that the test driver cannot tell which variant is
actually “<span class="quote">correct</span>” for the current environment; it will just pick
the variant that seems to work best. Therefore it is safest to use this
mechanism only for variant results that you are willing to consider
equally valid in all contexts.
</p>
</div></body>
</html>
|