gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
7.0KB

  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>32.3. Variant Comparison Files</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="prev" href="regress-evaluation.html" title="32.2. Test Evaluation" /><link rel="next" href="regress-tap.html" title="32.4. TAP Tests" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">32.3. Variant Comparison Files</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="regress-evaluation.html" title="32.2. Test Evaluation">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="regress.html" title="Chapter 32. Regression Tests">Up</a></td><th width="60%" align="center">Chapter 32. Regression Tests</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 12.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="regress-tap.html" title="32.4. TAP Tests">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="REGRESS-VARIANT"><div class="titlepage"><div><div><h2 class="title" style="clear: both">32.3. Variant Comparison Files</h2></div></div></div><p>
  3. Since some of the tests inherently produce environment-dependent
  4. results, we have provided ways to specify alternate <span class="quote">“<span class="quote">expected</span>”</span>
  5. result files. Each regression test can have several comparison files
  6. showing possible results on different platforms. There are two
  7. independent mechanisms for determining which comparison file is used
  8. for each test.
  9. </p><p>
  10. The first mechanism allows comparison files to be selected for
  11. specific platforms. There is a mapping file,
  12. <code class="filename">src/test/regress/resultmap</code>, that defines
  13. which comparison file to use for each platform.
  14. To eliminate bogus test <span class="quote">“<span class="quote">failures</span>”</span> for a particular platform,
  15. you first choose or make a variant result file, and then add a line to the
  16. <code class="filename">resultmap</code> file.
  17. </p><p>
  18. Each line in the mapping file is of the form
  19. </p><pre class="synopsis">
  20. testname:output:platformpattern=comparisonfilename
  21. </pre><p>
  22. The test name is just the name of the particular regression test
  23. module. The output value indicates which output file to check. For the
  24. standard regression tests, this is always <code class="literal">out</code>. The
  25. value corresponds to the file extension of the output file.
  26. The platform pattern is a pattern in the style of the Unix
  27. tool <code class="command">expr</code> (that is, a regular expression with an implicit
  28. <code class="literal">^</code> anchor at the start). It is matched against the
  29. platform name as printed by <code class="command">config.guess</code>.
  30. The comparison file name is the base name of the substitute result
  31. comparison file.
  32. </p><p>
  33. For example: some systems lack a working <code class="literal">strtof</code> function,
  34. for which our workaround causes rounding errors in the
  35. <code class="filename">float4</code> regression test.
  36. Therefore, we provide a variant comparison file,
  37. <code class="filename">float4-misrounded-input.out</code>, which includes
  38. the results to be expected on these systems. To silence the bogus
  39. <span class="quote">“<span class="quote">failure</span>”</span> message on <span class="systemitem">HP-UX 10</span>
  40. platforms, <code class="filename">resultmap</code> includes:
  41. </p><pre class="programlisting">
  42. float4:out:hppa.*-hp-hpux10.*=float4-misrounded-input.out
  43. </pre><p>
  44. which will trigger on any machine where the output of
  45. <code class="command">config.guess</code> matches <code class="literal">hppa.*-hp-hpux10.*</code>.
  46. Other lines in <code class="filename">resultmap</code> select the variant comparison
  47. file for other platforms where it's appropriate.
  48. </p><p>
  49. The second selection mechanism for variant comparison files is
  50. much more automatic: it simply uses the <span class="quote">“<span class="quote">best match</span>”</span> among
  51. several supplied comparison files. The regression test driver
  52. script considers both the standard comparison file for a test,
  53. <code class="literal"><em class="replaceable"><code>testname</code></em>.out</code>, and variant files named
  54. <code class="literal"><em class="replaceable"><code>testname</code></em>_<em class="replaceable"><code>digit</code></em>.out</code>
  55. (where the <em class="replaceable"><code>digit</code></em> is any single digit
  56. <code class="literal">0</code>-<code class="literal">9</code>). If any such file is an exact match,
  57. the test is considered to pass; otherwise, the one that generates
  58. the shortest diff is used to create the failure report. (If
  59. <code class="filename">resultmap</code> includes an entry for the particular
  60. test, then the base <em class="replaceable"><code>testname</code></em> is the substitute
  61. name given in <code class="filename">resultmap</code>.)
  62. </p><p>
  63. For example, for the <code class="literal">char</code> test, the comparison file
  64. <code class="filename">char.out</code> contains results that are expected
  65. in the <code class="literal">C</code> and <code class="literal">POSIX</code> locales, while
  66. the file <code class="filename">char_1.out</code> contains results sorted as
  67. they appear in many other locales.
  68. </p><p>
  69. The best-match mechanism was devised to cope with locale-dependent
  70. results, but it can be used in any situation where the test results
  71. cannot be predicted easily from the platform name alone. A limitation of
  72. this mechanism is that the test driver cannot tell which variant is
  73. actually <span class="quote">“<span class="quote">correct</span>”</span> for the current environment; it will just pick
  74. the variant that seems to work best. Therefore it is safest to use this
  75. mechanism only for variant results that you are willing to consider
  76. equally valid in all contexts.
  77. </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="regress-evaluation.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="regress.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="regress-tap.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">32.2. Test Evaluation </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 32.4. TAP Tests</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1