Movatterモバイル変換


[0]ホーム

URL:



Facebook
Postgres Pro
Facebook
Downloads
31.3. Variant Comparison Files
Prev UpChapter 31. Regression TestsHome Next

31.3. Variant Comparison Files#

Since some of the tests inherently produce environment-dependent results, we have provided ways to specify alternateexpected 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.

The first mechanism allows comparison files to be selected for specific platforms. There is a mapping file,src/test/regress/resultmap, that defines which comparison file to use for each platform. To eliminate bogus testfailures for a particular platform, you first choose or make a variant result file, and then add a line to theresultmap file.

Each line in the mapping file is of the form

testname:output:platformpattern=comparisonfilename

The test name is just the name of the particular regression test module. The output value indicates which output file to check. For the standard regression tests, this is alwaysout. The value corresponds to the file extension of the output file. The platform pattern is a pattern in the style of the Unix toolexpr (that is, a regular expression with an implicit^ anchor at the start). It is matched against the platform name as printed byconfig.guess. The comparison file name is the base name of the substitute result comparison file.

For example: some systems lack a workingstrtof function, for which our workaround causes rounding errors in thefloat4 regression test. Therefore, we provide a variant comparison file,float4-misrounded-input.out, which includes the results to be expected on these systems. To silence the bogusfailure message onCygwin platforms,resultmap includes:

float4:out:.*-.*-cygwin.*=float4-misrounded-input.out

which will trigger on any machine where the output ofconfig.guess matches.*-.*-cygwin.*. Other lines inresultmap select the variant comparison file for other platforms where it's appropriate.

The second selection mechanism for variant comparison files is much more automatic: it simply uses thebest match among several supplied comparison files. The regression test driver script considers both the standard comparison file for a test,testname.out, and variant files namedtestname_digit.out (where thedigit is any single digit0-9). 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. (Ifresultmap includes an entry for the particular test, then the basetestname is the substitute name given inresultmap.)

For example, for thechar test, the comparison filechar.out contains results that are expected in theC andPOSIX locales, while the filechar_1.out contains results sorted as they appear in many other locales.

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 actuallycorrect 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.


Prev Up Next
31.2. Test Evaluation Home 31.4. TAP Tests
pdfepub
Go to PostgreSQL 17
By continuing to browse this website, you agree to the use of cookies. Go toPrivacy Policy.

[8]ページ先頭

©2009-2025 Movatter.jp