From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Stephen Frost <sfrost@snowman.net>
Cc: Magnus Hagander <magnus@hagander.net>
Cc: PostgreSQL WWW <pgsql-www@lists.postgresql.org>
Subject: Re: Bogus reports from coverage.postgresql.org
Date: Wed, 14 Mar 2018 12:31:45 -0400
Message-ID: <5744.1521045105@sss.pgh.pa.us> (raw)
In-Reply-To: <4710.1521044117@sss.pgh.pa.us>
References: <20180314154352.ao4psdohgxd4pw65@alvherre.pgsql>
<4710.1521044117@sss.pgh.pa.us>
I wrote:
> I also notice an interesting warning with either version:
> $ make coverage-html
> /usr/bin/lcov --gcov-tool /usr/bin/gcov -q --no-external -c -i -d . -d . -o lcov_base.info
> geninfo: Note: --initial does not generate branch coverage data
> /usr/bin/lcov --gcov-tool /usr/bin/gcov -q --no-external -c -d . -d . -o lcov_test.info
> rm -rf coverage
> /usr/bin/genhtml -q --legend -o coverage --title='PostgreSQL 11devel' --num-spaces=4 --prefix='/home/tgl/pgsql' lcov_base.info lcov_test.info
> touch coverage-html-stamp
> No idea what "--initial" refers to, but it suggests that we're
> misusing the tool somehow with this configuration.
So I went and read the lcov man page, and according to it we're doing
this entirely wrong. The correct process, saith lcov, is
-i
--initial
Capture initial zero coverage data.
Run lcov with -c and this option on the directories containing
.bb, .bbg or .gcno files before running any test case. The
result is a "baseline" coverage data file that contains zero
coverage for every instrumented line. Combine this data file
(using lcov -a) with coverage data files captured after a test
run to ensure that the percentage of total lines covered is cor-
rect even when not all source code files were loaded during the
test.
Recommended procedure when capturing data for a test case:
1. create baseline coverage data file
# lcov -c -i -d appdir -o app_base.info
2. perform test
# appdir/test
3. create test coverage data file
# lcov -c -d appdir -o app_test.info
4. combine baseline and test coverage data
# lcov -a app_base.info -a app_test.info -o
app_total.info
Our process swaps steps 1 and 2. What I now suspect is that
we accidentally get away with that for basic mode, but it
doesn't work with lcov_branch_coverage.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-www@postgresql.org
Cc: tgl@sss.pgh.pa.us, peter.eisentraut@2ndquadrant.com, alvherre@alvh.no-ip.org, sfrost@snowman.net, magnus@hagander.net, pgsql-www@lists.postgresql.org
Subject: Re: Bogus reports from coverage.postgresql.org
In-Reply-To: <5744.1521045105@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox