Re: Extension coverage

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Gabriel Furstenheim Milerud <furstenheim(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Re: Extension coverage
Date: 2017-08-26 04:40:53
Message-ID: CAB7nPqQkUyN_A88Rw4iAaYax=m4DwNPwoScBVyb3ihmfks8uDg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Aug 26, 2017 at 2:59 AM, Gabriel Furstenheim Milerud
<furstenheim(at)gmail(dot)com> wrote:
> The I built my extension against this postgres server
>
> $ cd $EXTENSION_SOURCE_DIR
> $ make install && make installcheck
>
> the extension is built fine and the test run. However, I see no difference
> with a normal installation without the flag.
>
> Then I run the following target
> (https://stackoverflow.com/questions/31417900/how-to-run-coverage-report-on-a-postgres-extension)
> coverage:
> lcov --no-external -d . -c -o lcov.info
> genhtml --show-details --legend --output-directory=coverage
> --title=PostgreSQL --num-spaces=4 --prefix=./src/ `find . -name lcov.info
> -print`
>
> But it complains that there are no .gcda files
> geninfo: WARNING: no .gcda files found in . - skipping!
> and it errors.
> genhtml: ERROR: no valid records found in tracefile ./lcov.info
>
> Is this the way to measure coverage on an extension? Am I missing some step?

This error is a bit weird, what you are showing here has nothing
wrong. I do work with this coverage target and postgres extensions,
and the following steps allow me to generate a text report of coverage
when compiling any extension with a Postgres build having
--enable-coverage:
make install
make installcheck
make coverage
Trying to use coverage-html from an external extension leads to an error:
$ make coverage-html
rm -rf coverage
mkdir coverage
/home/ioltas/extra/bin/genhtml --show-details --legend
--output-directory=coverage --title=PostgreSQL --num-spaces=4
--prefix= `find . -name lcov.info -print`
genhtml: Option prefix requires an argument
Use genhtml --help to get usage information

But this bit is easy enough to fix by enforcing the value of
abs_top_srcdir when running the command "make coverage-html".
--
Michael

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gabriel Furstenheim Milerud 2017-08-26 09:28:11 Re: Extension coverage
Previous Message Rob Sargent 2017-08-26 01:34:25 Re: jdbc driver vis Release 10