Re: Having problems generating a code coverage report

From: Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Aleksander Alekseev <aleksander(at)timescale(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, jian he <jian(dot)universality(at)gmail(dot)com>, Peter Geoghegan <pg(at)bowt(dot)ie>
Subject: Re: Having problems generating a code coverage report
Date: 2026-06-11 00:49:47
Message-ID: CAOYmi+=Q5vc9opdg6PGM8RVgchu7SaDNPoN9D3XUF++Bmbyy_w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jan 21, 2026 at 5:59 PM Andres Freund <andres(at)anarazel(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2026-06-11 00:49:59 Re: Commit Sequence Numbers and Visibility
Previous Message Peter Smith 2026-06-11 00:36:22 Re: DOCS - Add missing EXCEPT parameter description to ALTER PUBLICATION