Re: Having problems generating a code coverage report - Mailing list pgsql-hackers

From Jacob Champion
Subject Re: Having problems generating a code coverage report
Date
Msg-id CAOYmi+=Q5vc9opdg6PGM8RVgchu7SaDNPoN9D3XUF++Bmbyy_w@mail.gmail.com
Whole thread
In response to Re: Having problems generating a code coverage report  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On Wed, Jan 21, 2026 at 5:59 PM Andres Freund <andres@anarazel.de> wrote:
> 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.

Setting `genhtml_no_prefix = 1` fixes the directory name collision for
me (clang 22, lcov 2.4) without rehoming the build directory. (As does
hacking meson to pass the source root --prefix before the build root,
which makes for prettier output. Apparently lcov doesn't handle the
case where one prefix is a substring of the other very well.)

Also, in case it helps anyone: I found that clang-15 generates
outright buggy .gcno information for some of our #included C snippets,
such as `#include "equalfuncs.switch.c"`, and lcov-2's stricter
processing correctly complains about it. Apparently that was fixed at
some point with newer clangs.

--Jacob



pgsql-hackers by date:

Previous
From: Peter Smith
Date:
Subject: Re: DOCS - Add missing EXCEPT parameter description to ALTER PUBLICATION
Next
From: Jeff Davis
Date:
Subject: Re: Commit Sequence Numbers and Visibility