Re: Having problems generating a code coverage report

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Michael Paquier <michael@paquier.xyz>
Cc: Aleksander Alekseev <aleksander@timescale.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, jian he <jian.universality@gmail.com>, Peter Geoghegan <pg@bowt.ie>
Date: 2026-01-22T01:59:45Z
Lists: pgsql-hackers
Hi,

On 2026-01-22 09:48:35 +0900, Michael Paquier wrote:
> On Wed, Jan 21, 2026 at 01:57:58PM -0500, Andres Freund wrote:
> > I just encountered this. The problem seems to only happen when the build
> > directory is inside the source directory.
> > 
> > Not that that's a great solution, but just having the build dir be in a
> > separate directory fixed the issue for me.
> 
> Even with a VPATH build on Debien GID?

Well, mine was a meson build.


> meson is no better as far as I've tried, so I have pretty much given
> up with coverage reports in this environment at this stage.  If there
> is a magic recipe, I am not really aware of one..

I have the following .lcovrc in my postgres source dir:

ignore_errors=inconsistent,gcov,range
check_data_consistency=0
stop_on_error=0
genhtml_hierarchical=1
genhtml_show_navigation=1
parallel=16
geninfo_gcov_tool=/usr/bin/gcov-15

(assuming you build with gcc 15)

With that meson coverage information works (i.e. ninja coverage-html) for both
lcov 2.0 and 2.4 as long as the build directory is outside of the source
directory. Both on Debian Sid and macos.

Greetings,

Andres Freund