バージョンごとのドキュメント一覧

33.2. テストの評価 #

<title>Test Evaluation</title>

Some properly installed and fully functional <productname>PostgreSQL</productname> installations can <quote>fail</quote> some of these regression tests due to platform-specific artifacts such as varying floating-point representation and message wording. The tests are currently evaluated using a simple <command>diff</command> comparison against the outputs generated on a reference system, so the results are sensitive to small system differences. When a test is reported as <quote>failed</quote>, always examine the differences between expected and actual results; you might find that the differences are not significant. Nonetheless, we still strive to maintain accurate reference files across all supported platforms, so it can be expected that all tests pass. 適正にインストールされ、かつ、すべての機能が使用できるようなPostgreSQLインストレーションであっても、浮動小数点の表現やメッセージ内の単語順など、プラットフォーム特有の誤差のために失敗することがあります。 現在のテストは単純に、(基準となる)参照用システムで生成した出力とのdiffを取ることで結果の検証を行っているため、システムの些細な違いにも反応します。 結果が失敗となった場合は、予測された結果と実際の結果との差分を必ず評価してください。 それらの差異が重大ではないことが判明することもあります。 なお、すべてのテストが成功するように、サポートするすべてのプラットフォームに対する正確な参照ファイルの保守に努めています。

The actual outputs of the regression tests are in files in the <filename>src/test/regress/results</filename> directory. The test script uses <command>diff</command> to compare each output file against the reference outputs stored in the <filename>src/test/regress/expected</filename> directory. Any differences are saved for your inspection in <filename>src/test/regress/regression.diffs</filename>. (When running a test suite other than the core tests, these files of course appear in the relevant subdirectory, not <filename>src/test/regress</filename>.) 実際のリグレッションテストの出力は、src/test/regress/resultsディレクトリ内のファイルに書き込まれます。 テストスクリプトはdiffを使用して、各出力ファイルとsrc/test/regress/expectedディレクトリ内の参照用出力とを比較します。 あらゆる差異は調査用にsrc/test/regress/regression.diffsに保存されます。 (コアテスト以外のテストスイートを実行する場合には、上記のファイルはもちろんsrc/test/regressではなく適切なサブディレクトリに現れます。)

If you don't like the <command>diff</command> options that are used by default, set the environment variable <envar>PG_REGRESS_DIFF_OPTS</envar>, for instance <literal>PG_REGRESS_DIFF_OPTS='-c'</literal>. (Or you can run <command>diff</command> yourself, if you prefer.) デフォルトで利用されているdiffオプションが気に入らなければ、例えばPG_REGRESS_DIFF_OPTS='-c'のように、環境変数PG_REGRESS_DIFF_OPTSを設定して下さい。 (あるいは、自分でdiffを実行することもできます。)

If for some reason a particular platform generates a <quote>failure</quote> for a given test, but inspection of the output convinces you that the result is valid, you can add a new comparison file to silence the failure report in future test runs. See <xref linkend="regress-variant"/> for details. 何らかの理由で、特定のプラットフォームが指定した試験で失敗し、その出力の調査により結果の方が有効であると確信できた場合、新しい比較用ファイルを追加し、今後の試験で失敗の報告が発生しないようにすることができます。 詳細は33.3を参照してください。

33.2.1. エラーメッセージの違い #

<title>Error Message Differences</title>

Some of the regression tests involve intentional invalid input values. Error messages can come from either the <productname>PostgreSQL</productname> code or from the host platform system routines. In the latter case, the messages can vary between platforms, but should reflect similar information. These differences in messages will result in a <quote>failed</quote> regression test that can be validated by inspection. リグレッションテストのいくつかは、意図的に無効な入力値を使用します。 エラーメッセージはPostgreSQLのコードによるもの、または使用しているプラットフォームの関数によるものがあります。 後者の場合、プラットフォームによって違いがあるかもしれませんが、似たような内容になるはずです。 これらのメッセージの違いによりリグレッションテストは失敗する可能性がありますが、これらは検査で確認できます。

33.2.2. ロケールの違い #

<title>Locale Differences</title>

If you run the tests against a server that was initialized with a collation-order locale other than C, then there might be differences due to sort order and subsequent failures. The regression test suite is set up to handle this problem by providing alternate result files that together are known to handle a large number of locales. Cロケール以外の照合順序のロケールで初期化されたサーバに対してテストを実行する際には、ソート順やその後に発生する失敗に違いが生じる可能性があります。 リグレッションテストスイートはこの問題を解決するために、多くのロケールを処理するための代替の結果ファイルを提供するように設定されています。

To run the tests in a different locale when using the temporary-installation method, pass the appropriate locale-related environment variables on the <command>make</command> command line, for example: 一時的なインストレーションを使用して、異なるロケールのテストを実行するためには、以下の例のように、makeコマンドラインに適切なロケール関連の環境変数を渡してください。

make check LANG=de_DE.utf8

(The regression test driver unsets <envar>LC_ALL</envar>, so it does not work to choose the locale using that variable.) To use no locale, either unset all locale-related environment variables (or set them to <literal>C</literal>) or use the following special invocation: (リグレッションテストのドライバはLC_ALLを設定しないため、この変数を使ってロケールを選択することはできません。) ロケール無しを使用するためには、すべてのロケール関連の環境変数を設定しない(または、それらをCに設定する)か、もしくは以下の特殊な起動を行います。

make check NO_LOCALE=1

When running the tests against an existing installation, the locale setup is determined by the existing installation. To change it, initialize the database cluster with a different locale by passing the appropriate options to <command>initdb</command>. 既存のインストレーションに対してテストを実行する場合は、ロケール設定は既存のインストレーションによって決まります。 変更するためには、initdbに適切なオプションを渡して、異なるロケールでデータベースクラスタを初期化してください。

In general, it is advisable to try to run the regression tests in the locale setup that is wanted for production use, as this will exercise the locale- and encoding-related code portions that will actually be used in production. Depending on the operating system environment, you might get failures, but then you will at least know what locale-specific behaviors to expect when running real applications. 実際に実運用で使用されるロケールおよび符号化方式に関連した部分のコードが検証されますので、一般的には、実運用で使用されるロケール設定でリグレッションテストを実行することを推奨します。 オペレーティングシステム環境に依存して、結果が失敗する場合もありますが、少なくとも実際のアプリケーションを実行する時に想定されるロケール固有の動作を知ることができます。

33.2.3. 日付と時刻の違い #

<title>Date and Time Differences</title>

Most of the date and time results are dependent on the time zone environment. The reference files are generated for time zone <literal>PST8PDT</literal> (Berkeley, California), and there will be apparent failures if the tests are not run with that time zone setting. The regression test driver sets environment variable <envar>PGTZ</envar> to <literal>PST8PDT</literal>, which normally ensures proper results. 日付と時刻の結果のほとんどはタイムゾーンの環境に依存します。 参照ファイルはタイムゾーン PST8PDT (Berkeley, California) 用に生成されているため、このタイムゾーン設定で実行されていないテストは明らかに失敗します。 リグレッションテストのドライバは、適切な結果を保証するために、環境変数PGTZPST8PDTを設定します。

33.2.4. 浮動小数点数の違い #

<title>Floating-Point Differences</title>

Some of the tests involve computing 64-bit floating-point numbers (<type>double precision</type>) from table columns. Differences in results involving mathematical functions of <type>double precision</type> columns have been observed. The <literal>float8</literal> and <literal>geometry</literal> tests are particularly prone to small differences across platforms, or even with different compiler optimization settings. Human eyeball comparison is needed to determine the real significance of these differences which are usually 10 places to the right of the decimal point. いくつかのテストでは、64ビット(double precision型)の浮動小数点数値をテーブルの列から取り出して計算を行います。 double precision列における数学演算関数では、異なった結果が発生する場合があることが知られています。 float8geometryテストは特に、プラットフォーム間、またはコンパイラの最適化の設定による小さな違いが起こりやすくなります。 これらの違い、通常は小数点以下10桁目以降の相違の、実際の影響度を判断するためには、人間の目で実際に確認する必要があります。

Some systems display minus zero as <literal>-0</literal>, while others just show <literal>0</literal>. いくつかのシステムではマイナス0を-0と表示することがあり、その他のシステムでは単に0と表示します。

Some systems signal errors from <function>pow()</function> and <function>exp()</function> differently from the mechanism expected by the current <productname>PostgreSQL</productname> code. いくつかのシステムでは、現在のPostgreSQLのコードが想定しているメカニズムと異なるために、pow()exp()でエラーを発生する場合があります。

33.2.5. 行の順序の違い #

<title>Row Ordering Differences</title>

You might see differences in which the same rows are output in a different order than what appears in the expected file. In most cases this is not, strictly speaking, a bug. Most of the regression test scripts are not so pedantic as to use an <literal>ORDER BY</literal> for every single <literal>SELECT</literal>, and so their result row orderings are not well-defined according to the SQL specification. In practice, since we are looking at the same queries being executed on the same data by the same software, we usually get the same result ordering on all platforms, so the lack of <literal>ORDER BY</literal> is not a problem. Some queries do exhibit cross-platform ordering differences, however. When testing against an already-installed server, ordering differences can also be caused by non-C locale settings or non-default parameter settings, such as custom values of <varname>work_mem</varname> or the planner cost parameters. 同じ行の出力が、参照ファイルで記述されている順序とは異なっている場合があります。 ほとんどの場合、これは厳密に言ってバグではありません。 ほとんどのリグレッションテストは、各SELECT文に対してORDER BYを使用するほど規則に厳しくなく、そのため、結果の行の順序はSQLの仕様に従って、明確に決まっていません。 実際には、同じソフトウェアで同じデータを用いて同じ問い合わせで参照しているので、すべてのプラットフォームで同じ順序の結果が返されるため、ORDER BYがないことは問題ではないと言えます。 しかし、問い合わせによっては、プラットフォーム間の順序の違いが起こる可能性があります。 インストール済みのサーバに対して試験を行う場合、C以外のロケール、独自のwork_memや独自のプランナ用のコストパラメータなどデフォルト以外のパラメータ設定により順序の違いが生じる可能性があります。

Therefore, if you see an ordering difference, it's not something to worry about, unless the query does have an <literal>ORDER BY</literal> that your result is violating. However, please report it anyway, so that we can add an <literal>ORDER BY</literal> to that particular query to eliminate the bogus <quote>failure</quote> in future releases. したがって、順序の違いを見つけた場合、問い合わせにORDER BYが含まれていて順序が影響を及ぼす場合以外は、気にする必要はありません。 ただし、その場合にもとにかくご一報ください。特定の問い合わせから偽の失敗を取り除くために、将来のリリースにおいて、ORDER BYを追加します。

You might wonder why we don't order all the regression test queries explicitly to get rid of this issue once and for all. The reason is that that would make the regression tests less useful, not more, since they'd tend to exercise query plan types that produce ordered results to the exclusion of those that don't. このような問題を避けるために、なぜ我々がすべてのリグレッションテストに対して明示的に順序を指定しないのか、疑問に思うかもしれません。 その理由は、ソートが必要がない場合であってもソートされた結果を生成する問い合わせ計画を実行しようとすることによって、リグレッションテストの意義が増すわけではなく、むしろ減るからです。

33.2.6. スタック長の不足 #

<title>Insufficient Stack Depth</title>

If the <literal>errors</literal> test results in a server crash at the <literal>select infinite_recurse()</literal> command, it means that the platform's limit on process stack size is smaller than the <xref linkend="guc-max-stack-depth"/> parameter indicates. This can be fixed by running the server under a higher stack size limit (4MB is recommended with the default value of <varname>max_stack_depth</varname>). If you are unable to do that, an alternative is to reduce the value of <varname>max_stack_depth</varname>. errorsテストがselect infinite_recurse()コマンドでサーバをクラッシュさせた場合、プラットフォームのプロセススタックサイズがmax_stack_depthパラメータが示す値よりも小さいことを意味します。 これは、スタックサイズ制限を高くして(デフォルトのmax_stack_depthでの推奨値は4メガバイト)サーバを実行することで修正することができます。 これを行うことができない場合、max_stack_depthの値を少なくすることが代替方法です。

On platforms supporting <function>getrlimit()</function>, the server should automatically choose a safe value of <varname>max_stack_depth</varname>; so unless you've manually overridden this setting, a failure of this kind is a reportable bug. getrlimit()をサポートするプラットフォームでは、サーバは自動的にmax_stack_depthの安全な値を選ぶべきです。 この設定を手で上書きしたのでない限り、この種の失敗は報告する価値のあるバグです。

33.2.7. 乱数 テスト #

<title>The <quote>random</quote> Test</title>

The <literal>random</literal> test script is intended to produce random results. In very rare cases, this causes that regression test to fail. Typing: randomテストスクリプトは、無作為な結果を生成することを目的としています。 非常に稀ですが、これがリグレッションテストが失敗する原因になることがあります。 次のように、

diff results/random.out expected/random.out

should produce only one or a few lines of differences. You need not worry unless the random test fails repeatedly. と入力すると、ほんの数行だけの差異が生じるはずです。 繰り返し失敗しない限り、気に留める必要はありません。

33.2.8. 設定パラメータ #

<title>Configuration Parameters</title>

When running the tests against an existing installation, some non-default parameter settings could cause the tests to fail. For example, changing parameters such as <varname>enable_seqscan</varname> or <varname>enable_indexscan</varname> could cause plan changes that would affect the results of tests that use <command>EXPLAIN</command>. 既存のインストレーションに対してテストを実行する場合、デフォルトでないパラメータ設定はテストが失敗する原因になり得ます。 例えば、enable_seqscanenable_indexscanのようなパラメータの変更は、EXPLAINを使うテストの結果に影響する計画の変更の原因となり得ます。