The regression tests are a comprehensive set of tests for the SQL implementation in PostgreSQL. They test standard SQL operations as well as the extended capabilities of PostgreSQL. Typically, you run these tests at the end of the PostgreSQL installation process.
The regression test can be run against an already installed and running server, or using a temporary installation within the build tree. Furthermore, there is a "parallel" and a "sequential" mode for running the tests. The sequential mode runs each test script in turn, whereas the parallel mode starts up multiple server processes to run groups of tests in parallel. Parallel testing gives confidence that interprocess communication and locking are working correctly.
To run the regression tests after building but before installation, enter:
$ make check |
====================== All 98 tests passed. ====================== |
![]() | Because this test method runs a temporary server, it will not work when you are the root user (the server will not start as root). If you already did the build as root, you do not have to start all over. Instead, make the regression test directory writable by some other user, log in as that user, and restart the tests. For example:
|
To run the tests, initialize a data area in the "C" locale, start the server (as explained in the Administrator and User's Guide), then enter:
$ make installcheck |
The tests are currently evaluated using a simple diff comparison against the outputs generated on a reference system, so the results are sensitive to small system differences. When a test is reported as "failed", always examine the differences between expected and actual results; you may well find that the differences are not significant. Nonetheless, we still strive to maintain accurate reference files, so it can be expected that all tests pass.
The actual outputs of the regression tests are in files in the src/test/regress/results directory. The test script uses diff to compare each output file against the reference outputs stored in the src/test/regress/expected directory. Any differences are saved for your inspection in src/test/regress/regression.diffs. src/test/regress/regression.out. which lists which test cases pass and fail. (You can also run diff yourself, if you prefer.)
Some of the regression tests involve intentional invalid input values. Error messages can come from either the PostgreSQL code or from the Linux system routines.
The tests expect to run in plain "C" locale (which is the default locale for PostgreSQL). This should not cause any problems when you run the tests against a temporary installation, since the regression test driver takes care to start the server in C locale. However, if you run the tests against an already-installed server that is using non-C locale settings, you may see differences caused by varying rules for string sort order, formatting of numeric and monetary values, and so forth.
In some locales the resulting differences are small and easily checked by inspection. However, in a locale that changes the rules for formatting of numeric values (typically by swapping the usage of commas and decimal points), entry of some data values will fail, resulting in extensive differences later in the tests where the missing data values are supposed to be used.
Most of the date and time results are dependent on the time zone environment. The reference files are generated for time zone PST8PDT (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 PGTZ to PST8PDT to ensure proper results. However, your system must provide library support for the PST8PDT time zone, or the time zone-dependent tests will fail. To verify that your machine does have this support, type the following:
$ env TZ=PST8PDT date |
PGTZ='PST8PDT7,M04.01.0,M10.05.03'; export PGTZ |
There is at least one case in the "random" test script that is intended to produce random results. This causes random to fail the regression test once in a while (perhaps once in every five to ten trials). Typing
diff results/random.out expected/random.out |