33.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 it requires the
A typical workflow looks like this:
./configure --enable-coverage ... OTHER OPTIONS ...
make check # or other test suite
Then point your HTML browser to
If you don't have
lcovor prefer text output over an HTML report, you can run
make coverage-html, which will produce
.gcovoutput files for each source file relevant to the test. (
make coverage-htmlwill overwrite each other's files, so mixing them might be confusing.)
You can run several different tests before making the coverage report; the execution counts will accumulate. If you want to reset the execution counts between test runs, run:
You can run the
make coveragecommand in a subdirectory if you want a coverage report for only a portion of the code tree.
make distcleanto clean up when done.