blob: 0b8de3144a1cfbd7c0c76832738d5509bf4efdec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
<?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.4. TAP 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-variant.html" title="33.3. Variant Comparison Files" /><link rel="next" href="regress-coverage.html" title="33.5. Test Coverage Examination" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">33.4. TAP Tests</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="regress-variant.html" title="33.3. Variant Comparison Files">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 16.3 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="regress-coverage.html" title="33.5. Test Coverage Examination">Next</a></td></tr></table><hr /></div><div class="sect1" id="REGRESS-TAP"><div class="titlepage"><div><div><h2 class="title" style="clear: both">33.4. TAP Tests <a href="#REGRESS-TAP" class="id_link">#</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="regress-tap.html#REGRESS-TAP-VARS">33.4.1. Environment Variables</a></span></dt></dl></div><p>
Various tests, particularly the client program tests
under <code class="filename">src/bin</code>, use the Perl TAP tools and are run
using the Perl testing program <code class="command">prove</code>. You can pass
command-line options to <code class="command">prove</code> by setting
the <code class="command">make</code> variable <code class="varname">PROVE_FLAGS</code>, for example:
</p><pre class="programlisting">
make -C src/bin check PROVE_FLAGS='--timer'
</pre><p>
See the manual page of <code class="command">prove</code> for more information.
</p><p>
The <code class="command">make</code> variable <code class="varname">PROVE_TESTS</code>
can be used to define a whitespace-separated list of paths relative
to the <code class="filename">Makefile</code> invoking <code class="command">prove</code>
to run the specified subset of tests instead of the default
<code class="filename">t/*.pl</code>. For example:
</p><pre class="programlisting">
make check PROVE_TESTS='t/001_test1.pl t/003_test3.pl'
</pre><p>
</p><p>
The TAP tests require the Perl module <code class="literal">IPC::Run</code>.
This module is available from
<a class="ulink" href="https://metacpan.org/dist/IPC-Run" target="_top">CPAN</a>
or an operating system package.
They also require <span class="productname">PostgreSQL</span> to be
configured with the option <code class="option">--enable-tap-tests</code>.
</p><p>
Generically speaking, the TAP tests will test the executables in a
previously-installed installation tree if you say <code class="literal">make
installcheck</code>, or will build a new local installation tree from
current sources if you say <code class="literal">make check</code>. In either
case they will initialize a local instance (data directory) and
transiently run a server in it. Some of these tests run more than one
server. Thus, these tests can be fairly resource-intensive.
</p><p>
It's important to realize that the TAP tests will start test server(s)
even when you say <code class="literal">make installcheck</code>; this is unlike
the traditional non-TAP testing infrastructure, which expects to use an
already-running test server in that case. Some PostgreSQL
subdirectories contain both traditional-style and TAP-style tests,
meaning that <code class="literal">make installcheck</code> will produce a mix of
results from temporary servers and the already-running test server.
</p><div class="sect2" id="REGRESS-TAP-VARS"><div class="titlepage"><div><div><h3 class="title">33.4.1. Environment Variables <a href="#REGRESS-TAP-VARS" class="id_link">#</a></h3></div></div></div><p>
Data directories are named according to the test filename, and will be
retained if a test fails. If the environment variable
<code class="varname">PG_TEST_NOCLEAN</code> is set, data directories will be
retained regardless of test status. For example, retaining the data
directory regardless of test results when running the
<span class="application">pg_dump</span> tests:
</p><pre class="programlisting">
PG_TEST_NOCLEAN=1 make -C src/bin/pg_dump check
</pre><p>
This environment variable also prevents the test's temporary directories
from being removed.
</p><p>
Many operations in the test suites use a 180-second timeout, which on slow
hosts may lead to load-induced timeouts. Setting the environment variable
<code class="varname">PG_TEST_TIMEOUT_DEFAULT</code> to a higher number will change
the default to avoid this.
</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="regress-variant.html" title="33.3. Variant Comparison Files">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="regress.html" title="Chapter 33. Regression Tests">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="regress-coverage.html" title="33.5. Test Coverage Examination">Next</a></td></tr><tr><td width="40%" align="left" valign="top">33.3. Variant Comparison Files </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 33.5. Test Coverage Examination</td></tr></table></div></body></html>
|