Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > 9b6cc37ce608401d44f6535a0c7cb777 > files > 656

postgresql11-docs-11.5-1.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!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>33.1. Running the Tests</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 Vsnapshot" /><link rel="prev" href="regress.html" title="Chapter 33. Regression Tests" /><link rel="next" href="regress-evaluation.html" title="33.2. Test Evaluation" /></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">33.1. Running the Tests</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="regress.html" title="Chapter 33. Regression Tests">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="regress.html" title="Chapter 33. Regression Tests">Up</a></td><th width="60%" align="center">Chapter 33. Regression Tests</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 11.5 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="regress-evaluation.html" title="33.2. Test Evaluation">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="REGRESS-RUN"><div class="titlepage"><div><div><h2 class="title" style="clear: both">33.1. Running the Tests</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="regress-run.html#id-1.6.20.5.3">33.1.1. Running the Tests Against a Temporary Installation</a></span></dt><dt><span class="sect2"><a href="regress-run.html#id-1.6.20.5.4">33.1.2. Running the Tests Against an Existing Installation</a></span></dt><dt><span class="sect2"><a href="regress-run.html#id-1.6.20.5.5">33.1.3. Additional Test Suites</a></span></dt><dt><span class="sect2"><a href="regress-run.html#id-1.6.20.5.6">33.1.4. Locale and Encoding</a></span></dt><dt><span class="sect2"><a href="regress-run.html#id-1.6.20.5.7">33.1.5. Extra Tests</a></span></dt><dt><span class="sect2"><a href="regress-run.html#id-1.6.20.5.8">33.1.6. Testing Hot Standby</a></span></dt></dl></div><p>
   The regression tests can be run against an already installed and
   running server, or using a temporary installation within the build
   tree.  Furthermore, there is a <span class="quote">“<span class="quote">parallel</span>”</span> and a
   <span class="quote">“<span class="quote">sequential</span>”</span> mode for running the tests.  The
   sequential method runs each test script alone, while the
   parallel method starts up multiple server processes to run groups
   of tests in parallel.  Parallel testing adds confidence that
   interprocess communication and locking are working correctly.
  </p><div class="sect2" id="id-1.6.20.5.3"><div class="titlepage"><div><div><h3 class="title">33.1.1. Running the Tests Against a Temporary Installation</h3></div></div></div><p>
   To run the parallel regression tests after building but before installation,
   type:
</p><pre class="screen">
make check
</pre><p>
   in the top-level directory.  (Or you can change to
   <code class="filename">src/test/regress</code> and run the command there.)
   At the end you should see something like:
</p><pre class="screen">
<code class="computeroutput">
=======================
 All 115 tests passed.
=======================
</code>
</pre><p>
   or otherwise a note about which tests failed.  See <a class="xref" href="regress-evaluation.html" title="33.2. Test Evaluation">Section 33.2</a> below before assuming that a
   <span class="quote">“<span class="quote">failure</span>”</span> represents a serious problem.
  </p><p>
    Because this test method runs a temporary server, it will not work
    if you did the build as the root user, since the server will not start as
    root.  Recommended procedure is not to do the build as root, or else to
    perform testing after completing the installation.
   </p><p>
    If you have configured <span class="productname">PostgreSQL</span> to install
    into a location where an older <span class="productname">PostgreSQL</span>
    installation already exists, and you perform <code class="literal">make check</code>
    before installing the new version, you might find that the tests fail
    because the new programs try to use the already-installed shared
    libraries.  (Typical symptoms are complaints about undefined symbols.)
    If you wish to run the tests before overwriting the old installation,
    you'll need to build with <code class="literal">configure --disable-rpath</code>.
    It is not recommended that you use this option for the final installation,
    however.
   </p><p>
    The parallel regression test starts quite a few processes under your
    user ID.  Presently, the maximum concurrency is twenty parallel test
    scripts, which means forty processes: there's a server process and a
    <span class="application">psql</span> process for each test script.
    So if your system enforces a per-user limit on the number of processes,
    make sure this limit is at least fifty or so, else you might get
    random-seeming failures in the parallel test.  If you are not in
    a position to raise the limit, you can cut down the degree of parallelism
    by setting the <code class="literal">MAX_CONNECTIONS</code> parameter.  For example:
</p><pre class="screen">
make MAX_CONNECTIONS=10 check
</pre><p>
    runs no more than ten tests concurrently.
   </p></div><div class="sect2" id="id-1.6.20.5.4"><div class="titlepage"><div><div><h3 class="title">33.1.2. Running the Tests Against an Existing Installation</h3></div></div></div><p>
   To run the tests after installation (see <a class="xref" href="installation.html" title="Chapter 16. Installation from Source Code">Chapter 16</a>),
   initialize a data area and start the
   server as explained in <a class="xref" href="runtime.html" title="Chapter 18. Server Setup and Operation">Chapter 18</a>, then type:
</p><pre class="screen">
make installcheck
</pre><p>
or for a parallel test:
</p><pre class="screen">
make installcheck-parallel
</pre><p>
   The tests will expect to contact the server at the local host and the
   default port number, unless directed otherwise by <code class="envar">PGHOST</code> and
   <code class="envar">PGPORT</code> environment variables.  The tests will be run in a
   database named <code class="literal">regression</code>; any existing database by this name
   will be dropped.
  </p><p>
   The tests will also transiently create some cluster-wide objects, such as
   roles and tablespaces.  These objects will have names beginning with
   <code class="literal">regress_</code>.  Beware of using <code class="literal">installcheck</code>
   mode in installations that have any actual users or tablespaces named
   that way.
  </p></div><div class="sect2" id="id-1.6.20.5.5"><div class="titlepage"><div><div><h3 class="title">33.1.3. Additional Test Suites</h3></div></div></div><p>
   The <code class="literal">make check</code> and <code class="literal">make installcheck</code> commands
   run only the <span class="quote">“<span class="quote">core</span>”</span> regression tests, which test built-in
   functionality of the <span class="productname">PostgreSQL</span> server.  The source
   distribution also contains additional test suites, most of them having
   to do with add-on functionality such as optional procedural languages.
  </p><p>
   To run all test suites applicable to the modules that have been selected
   to be built, including the core tests, type one of these commands at the
   top of the build tree:
</p><pre class="screen">
make check-world
make installcheck-world
</pre><p>
   These commands run the tests using temporary servers or an
   already-installed server, respectively, just as previously explained
   for <code class="literal">make check</code> and <code class="literal">make installcheck</code>.  Other
   considerations are the same as previously explained for each method.
   Note that <code class="literal">make check-world</code> builds a separate temporary
   installation tree for each tested module, so it requires a great deal
   more time and disk space than <code class="literal">make installcheck-world</code>.
  </p><p>
   Alternatively, you can run individual test suites by typing
   <code class="literal">make check</code> or <code class="literal">make installcheck</code> in the appropriate
   subdirectory of the build tree.  Keep in mind that <code class="literal">make
   installcheck</code> assumes you've installed the relevant module(s), not
   only the core server.
  </p><p>
   The additional tests that can be invoked this way include:
  </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
     Regression tests for optional procedural languages (other than
     <span class="application">PL/pgSQL</span>, which is tested by the core tests).
     These are located under <code class="filename">src/pl</code>.
    </p></li><li class="listitem"><p>
     Regression tests for <code class="filename">contrib</code> modules,
     located under <code class="filename">contrib</code>.
     Not all <code class="filename">contrib</code> modules have tests.
    </p></li><li class="listitem"><p>
     Regression tests for the ECPG interface library,
     located in <code class="filename">src/interfaces/ecpg/test</code>.
    </p></li><li class="listitem"><p>
     Tests stressing behavior of concurrent sessions,
     located in <code class="filename">src/test/isolation</code>.
    </p></li><li class="listitem"><p>
     Tests of client programs under <code class="filename">src/bin</code>.  See
     also <a class="xref" href="regress-tap.html" title="33.4. TAP Tests">Section 33.4</a>.
    </p></li></ul></div><p>
   When using <code class="literal">installcheck</code> mode, these tests will destroy any
   existing databases named <code class="literal">pl_regression</code>,
   <code class="literal">contrib_regression</code>, <code class="literal">isolation_regression</code>,
   <code class="literal">ecpg1_regression</code>, or <code class="literal">ecpg2_regression</code>, as well as
   <code class="literal">regression</code>.
  </p><p>
   The TAP-based tests are run only when PostgreSQL was configured with the
   option <code class="option">--enable-tap-tests</code>.  This is recommended for
   development, but can be omitted if there is no suitable Perl installation.
  </p><p>
   Some test suites are not run by default, either because they are not secure
   to run on a multiuser system or because they require special software.  You
   can decide which test suites to run additionally by setting the
   <code class="command">make</code> or environment variable
   <code class="varname">PG_TEST_EXTRA</code> to a whitespace-separated list, for
   example:
</p><pre class="programlisting">
make check-world PG_TEST_EXTRA='kerberos ldap ssl'
</pre><p>
   The following values are currently supported:
   </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">kerberos</code></span></dt><dd><p>
       Runs the test suite under <code class="filename">src/test/kerberos</code>.  This
       requires an MIT Kerberos installation and opens TCP/IP listen sockets.
      </p></dd><dt><span class="term"><code class="literal">ldap</code></span></dt><dd><p>
       Runs the test suite under <code class="filename">src/test/ldap</code>.  This
       requires an <span class="productname">OpenLDAP</span> installation and opens
       TCP/IP listen sockets.
      </p></dd><dt><span class="term"><code class="literal">ssl</code></span></dt><dd><p>
       Runs the test suite under <code class="filename">src/test/ssl</code>.  This opens TCP/IP listen sockets.
      </p></dd></dl></div><p>

   Tests for features that are not supported by the current build
   configuration are not run even if they are mentioned in
   <code class="varname">PG_TEST_EXTRA</code>.
  </p></div><div class="sect2" id="id-1.6.20.5.6"><div class="titlepage"><div><div><h3 class="title">33.1.4. Locale and Encoding</h3></div></div></div><p>
    By default, tests using a temporary installation use the
    locale defined in the current environment and the corresponding
    database encoding as determined by <code class="command">initdb</code>.  It
    can be useful to test different locales by setting the appropriate
    environment variables, for example:
</p><pre class="screen">
make check LANG=C
make check LC_COLLATE=en_US.utf8 LC_CTYPE=fr_CA.utf8
</pre><p>
    For implementation reasons, setting <code class="envar">LC_ALL</code> does not
    work for this purpose; all the other locale-related environment
    variables do work.
   </p><p>
    When testing against an existing installation, the locale is
    determined by the existing database cluster and cannot be set
    separately for the test run.
   </p><p>
    You can also choose the database encoding explicitly by setting
    the variable <code class="envar">ENCODING</code>, for example:
</p><pre class="screen">
make check LANG=C ENCODING=EUC_JP
</pre><p>
    Setting the database encoding this way typically only makes sense
    if the locale is C; otherwise the encoding is chosen automatically
    from the locale, and specifying an encoding that does not match
    the locale will result in an error.
   </p><p>
    The database encoding can be set for tests against either a temporary or
    an existing installation, though in the latter case it must be
    compatible with the installation's locale.
   </p></div><div class="sect2" id="id-1.6.20.5.7"><div class="titlepage"><div><div><h3 class="title">33.1.5. Extra Tests</h3></div></div></div><p>
    The core regression test suite contains a few test files that are not
    run by default, because they might be platform-dependent or take a
    very long time to run.  You can run these or other extra test
    files by setting the variable <code class="envar">EXTRA_TESTS</code>.  For
    example, to run the <code class="literal">numeric_big</code> test:
</p><pre class="screen">
make check EXTRA_TESTS=numeric_big
</pre><p>
    To run the collation tests:
</p><pre class="screen">
make check EXTRA_TESTS='collate.linux.utf8 collate.icu.utf8' LANG=en_US.utf8
</pre><p>
    The <code class="literal">collate.linux.utf8</code> test works only on Linux/glibc
    platforms.  The <code class="literal">collate.icu.utf8</code> test only works when
    support for ICU was built.  Both tests will only succeed when run in a
    database that uses UTF-8 encoding.
   </p></div><div class="sect2" id="id-1.6.20.5.8"><div class="titlepage"><div><div><h3 class="title">33.1.6. Testing Hot Standby</h3></div></div></div><p>
   The source distribution also contains regression tests for the static
   behavior of Hot Standby. These tests require a running primary server
   and a running standby server that is accepting new WAL changes from the
   primary (using either file-based log shipping or streaming replication).
   Those servers are not automatically created for you, nor is replication
   setup documented here. Please check the various sections of the
   documentation devoted to the required commands and related issues.
  </p><p>
   To run the Hot Standby tests, first create a database
   called <code class="literal">regression</code> on the primary:
</p><pre class="screen">
psql -h primary -c "CREATE DATABASE regression"
</pre><p>
   Next, run the preparatory script
   <code class="filename">src/test/regress/sql/hs_primary_setup.sql</code>
   on the primary in the regression database, for example:
</p><pre class="screen">
psql -h primary -f src/test/regress/sql/hs_primary_setup.sql regression
</pre><p>
   Allow these changes to propagate to the standby.
  </p><p>
   Now arrange for the default database connection to be to the standby
   server under test (for example, by setting the <code class="envar">PGHOST</code> and
   <code class="envar">PGPORT</code> environment variables).
   Finally, run <code class="literal">make standbycheck</code> in the regression directory:
</p><pre class="screen">
cd src/test/regress
make standbycheck
</pre><p>
  </p><p>
   Some extreme behaviors can also be generated on the primary using the
   script <code class="filename">src/test/regress/sql/hs_primary_extremes.sql</code>
   to allow the behavior of the standby to be tested.
  </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="regress.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-evaluation.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 33. Regression Tests </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 33.2. Test Evaluation</td></tr></table></div></body></html>