Supported Versions: Current (16) / 15 / 14 / 13 / 12
Development Versions: 17 / devel
Unsupported versions: 11 / 10 / 9.6 / 9.5 / 9.4 / 9.3 / 9.2 / 9.1 / 9.0 / 8.4

32.5. Test Coverage Examination

The PostgreSQL source code can be compiled with coverage testing instrumentation, so that it becomes possible to examine which parts of the code are covered by the regression tests or any other test suite that is run with the code. This is currently supported when compiling with GCC and requires the gcov and lcov programs.

A typical workflow would look like this:

./configure --enable-coverage ... OTHER OPTIONS ...
make check # or other test suite
make coverage-html

Then point your HTML browser to coverage/index.html. The make commands also work in subdirectories.

If you don't have lcov or prefer text output over an HTML report, you can also run

make coverage

instead of make coverage-html, which will produce .gcov output files for each source file relevant to the test. (make coverage and make coverage-html will overwrite each other's files, so mixing them might be confusing.)

To reset the execution counts between test runs, run:

make coverage-clean

Submit correction

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.