Comments you submit will be routed for moderation. If you have an account, please log in first.
Modify

Ticket #3887 (closed enhancement: fixed)

Opened 3 years ago

Last modified 2 years ago

Check for gcno files in addition to gcda files

Reported by: daniel.neuberger@… Owned by: jdsiiro
Priority: normal Milestone:
Component: gcovr Version:
Keywords: Cc: wehart

Description

Currently, only files with .gcda extensions are searched for. The get_datafiles function has an option to change this, but the option is not exposed to end users.

I think gcno files, should be included by default as well. Otherwise, code that is never run at all is not included in the output.

It would also be nice if the extension option was exposed to end users.

Thanks.

Attachments

add_gcno_files.diff Download (852 bytes) - added by daniel.neuberger@… 3 years ago.
Patch that adds gcno files to the search by default

Change History

Changed 3 years ago by daniel.neuberger@…

Patch that adds gcno files to the search by default

comment:1 follow-up: ↓ 2 Changed 3 years ago by benjamin.depardon@…

Even with this patch, gcovr does not seem to take into account .gcno files without .gcda files.

comment:2 in reply to: ↑ 1 Changed 3 years ago by daniel.neuberger@…

Replying to benjamin.depardon@…:

Even with this patch, gcovr does not seem to take into account .gcno files without .gcda files.

Are you using the latest version of gcovr (2.2 I think)? What command are you runnning gcovr with? Also, what is your directory structure? Specifically, where are .gcno files, .gcda files, and source files in relation to where your running the gcovr script?

I have only tested the patch with our setup, so I'm not sure how portable it is. If you have a different set up, you may have to make changes to account for that. If you do, please submit the patch.

comment:3 Changed 3 years ago by jdsiiro

  • Cc wehart added

Closing #3879 as a duplicate of this ticket.

comment:4 Changed 3 years ago by benjamin.depardon@…

Hi,

I use the 2.2-prerelease version of gcovr. As far as I remember, I took it from the source link on this website.

The directory structure is as follows:
<root>

+ src/ # all the source files are here
+ build/ # we build the project in this directory, and the tests are run from here too

I use the following command to run gcovr, from the build directory:
/home/hudson/scripts/gcovr -v -x -r .. -e ".*boost.*" -e ".*omniORB4.*" -e ".*Testing.*" -e ".*/CORBA/idl/.*" -e ".*gsoap.*" -e ".*EucaLib?.*" -e ".*xercesc.*" -e ".*xqilla.*" -e "/usr/.*" -e "/opt/.*" -e ".*DynSK.cc" -o ../reports/coverage.xml

Our project is built using CMake, so all the *.gcno and *.gcda files are created in subdirectories in the build directory.
For example, we have the following source files: <root>/src/agent/{dietAgent.cc,LocalAgentImpl?.cc,MasterAgentImpl?.cc}, and the corresponding .gcno and gcda files are in: <root>/build/agent/CMakeFiles/dietAgent.dir

All the *.gcno files which do not have a .gcda file aren't taken into account, the report does not have any reference to those not executed files.

I did not make any changes to the script.
If I find a suitable patch, I'll submit it.

comment:5 Changed 3 years ago by daniel.neuberger@…

This sounds like a separate bug to me. The problem is not that gcovr isn't looking for .gcno files, but rather that it doesn't understand the CMake directory structure. This is just a guess though. I had the same problem with Automake and had to add a hack until it was fixed with #3872.

I'd encourage you to add a separate ticket for adding support for the CMake directory structure along with appropriate details and a reference to this ticket. Also, if possible, try writing a patch yourself and submitting it. The gcovr script is just python and it doesn't take much time to learn to write simple patches. Even something that's just a hack would give a good starting point for the maintainers to work from.

comment:6 Changed 3 years ago by anonymous

My mistake! It does work, it's just that the version of gcov installed on our server was "a bit" old (4.1.2), I updated it, and now it works just fine.

Sorry for the noise.

comment:7 Changed 3 years ago by wehart

  • Status changed from new to closed
  • Resolution set to invalid

comment:8 Changed 3 years ago by wehart

  • Status changed from closed to reopened
  • Resolution invalid deleted

comment:9 Changed 2 years ago by jdsiiro

  • Status changed from reopened to closed
  • Resolution set to fixed

Implemented in [2766]:

Process gcno files in addition to gcda files, but only if there is no corresponding gcda file.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.