Gregzor
Gregzor

Reputation: 302

How to run coverage report on a Postgres extension

I found out that there is a possibility to run run tests with coverage reports in PostgreSQL and this is also available for PostgreSQL extensions (from PGXN).

I have found two repositories that include coverage reports:

How do I run coverage reports locally on an extension? I think this should be provided by the generic PGXN Makefile.

Upvotes: 2

Views: 398

Answers (1)

Gregzor
Gregzor

Reputation: 302

Local coverage report may be achieved by:

  1. Installing Postgres with --enable-coverage flag
  2. Building the extension against the Postgres installation and it's pg_config
  3. Adding and calling target from the extension's Makefile
coverage: 
lcov -d . -c -o lcov.info
genhtml --show-details --legend --output-directory=coverage --title=PostgreSQL --num-spaces=4 --prefix=./src/ `find . -name lcov.info -print`

Credits go to Ronan Dunklau from pgxn-users mailing list.

Upvotes: 2

Related Questions