Re: gcov/lcov problems with branch coverage and c++

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks @Andre and @Xi.

I could reproduce the 100% conditional coverage when disabling exceptions. (as assumed)

The only problem is: The real production code is actually using exceptions. And with "-fno-exceptions" gcc refuses to compile code which uses exceptions.

Therefore we probably have to deal with the "low" branch coverage and simply redefine our scale of a adequate coverage. ;)

Best regards
Sven


Am 06.02.2017 um 23:58 schrieb andre maute:
On 02/02/2017 02:59 PM, Sven Eppler wrote:
Hello,
we are using GCOV/LCOV to produce test coverage for our projects.
Recently we tried to enable branch-coverage additionally.
But it looks like, this just doesn't yield the results we expected
from a high level developer view.

I created a small test project to show the problem:

   https://github.com/ghandmann/lcov-branch-coverage-weirdness

Currently we use Ubuntu 16.04. with:
 - gcc v5.4
 - lcov & genhtml v1.12

Our production code is build with c++11 enabled. The minimal example
isn't build with c++11 enabled,
but as we experimented a bit with all different options (c++ standard,
optimization, -fno-exceptions)
we didn't came up with a passable result.

Experimenting on my Fedora with lcov 1.12 (not 1.13) and a fedora repo
gcc-6.3.1 for fc24

$ g++ -vUsing built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/6.3.1/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-linker-hash-style=gnu --enable-plugin --enable-initfini-array
--disable-libgcj --with-isl --enable-libmpx
--enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux
Thread model: posix
gcc version 6.3.1 20161221 (Red Hat 6.3.1-1) (GCC)

The two variants
a) -fno-exceptions
b) -std=c++11 -fno-exceptions
give three times 100 percent

If you don't 'shut-down' the exceptions the branch coverage will be at
60 percent.

Regards Andre



Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux