Coverage with make coverage-html is broken on latest Debian using lcov v2
Hi all,
On Debian 13 (trixie), `make coverage-html` command triggers an lcov
failure.
There have been past reports of this failure in pgsql-hackers here
</messages/by-id/202602261231.mlk2icrqrwpw@alvherre.pgsql>
.
APT package repositories on Debian 13 default to lcov v2 (2.3.1-1) which
is stricter about a few warnings and triggers an error. This commit
<https://github.com/linux-test-project/lcov/commit/5f659f63801ef7f94c50a0eb5cffa1ea70f73651>in
lcov details some of the changes for lcov v2, including the stricter error
handling (see bullet b)).
After applying the attached patches to the current master branch, `make
coverage-html` starts working with lcov v2.
---
More details:
Without applying any of the patches, with --enable-coverage and in-tree
build (no vpath), make check && make coverage-html results in the following
error:
```
/usr/bin/lcov --gcov-tool /usr/bin/gcov -q --no-external -c -i -d . -d . -o
lcov_base.info
lcov: ERROR: (usage) duplicate file ./src/backend/access/table/tableam.gcno
in both . and .
(use "lcov --ignore-errors usage ..." to bypass this error)
Message summary:
1 error message:
usage: 1
make: *** [src/Makefile.global:1064: lcov_base.info] Error 1
```
After applying the first patch, I get this error:
```
genhtml: ERROR: (corrupt) unable to read trace file 'lcov_base.info':
genhtml: ERROR: (inconsistent) "lcov_base.info":507880: duplicate function
'blockreftable_create' starts on line
"/home/admin/postgres/src/include/lib/simplehash.h":450 but previous
definition started on 447 while merging lcov_base.info while loading
lcov_base.info.
(use "genhtml --ignore-errors inconsistent ..." to bypass this
error)
(use "genhtml --ignore-errors corrupt ..." to bypass this error)
make: *** [src/Makefile.global:1055: coverage-html-stamp] Error 1
```
With the other 2 patches also applied, make check && make coverage-html
starts producing proper reports.
I tested `make coverage-html` on Debian 13 with lcov v1 and everything
worked there as well.
Narek
--