LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-25-2009, 11:43 PM   #1
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,376

Rep: Reputation: 147Reputation: 147
Problem with LCOV GCOV


I am getting code coverage statistics with for one of my small library's that I'm currently testing. However, I'm getting a few odd results, lines that I know are being covered are not being counted, Other lines are being missed, until I cover them.

For lines being covered but missed see lines 63, 83, 96 & 113

For lines being missed see line 342

My library of routines is written in C++ and uses many QT routines.

I have compiled with and without optimisation and of course I include the flags -fprofile-arcs -ftest-coverage when both compiling and linking.

my commands to lcov are as follows:
Code:
lcov -z -d object/ -q

# generate a blank coverage file
lcov -c -i  -d object/ -o lcov_tmp/qgetopt_base.info -q
lcov -e lcov_tmp/qgetopt_base.info "*optionManager/opt*" -o lcov_tmp/qgetopt_base.info -q
   
# Run the tests
cd object/
./test2
cd ../

# generate the coverage data from the unit tests

lcov -c -d object/ -o lcov_tmp/qgetopt_utest.info -t unitTests -q
lcov -e lcov_tmp/qgetopt_utest.info "*optionManager/opt*" -o lcov_tmp/qgetopt_utest.info -q
lcov -a lcov_tmp/qgetopt_base.info -a lcov_tmp/qgetopt_utest.info  -a lcov_tmp/qgetopt_test.info -o lcov_tmp/qgetopt_total_coverage.info -q

# Generate the html report from the tests

genhtml -o ./coverage lcov_tmp/qgetopt_total_coverage.info -t "qgetopt test coverage" -s
Note: The coverage details in lcov_tmp/qgetopt_test.info are generated by the test2 program itself

My question: Is this something that I have to live with or is there a work around?

Last edited by graemef; 08-25-2009 at 11:47 PM. Reason: details about where lcov_tmp/qgetopt_test.info is generated
 
Old 08-26-2009, 12:07 AM   #2
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,376

Original Poster
Rep: Reputation: 147Reputation: 147
Typical, five minutes after posting my question I find the answer... At least for the lines being covered but missed. It's due to optimisation of the implied copy constructor. If I compile with -fno-elide-constructors it works as hoped.

I think that the other problem is due to the inlining of the code and that I can live with.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] lcov problems graemef Programming 1 08-23-2009 01:02 AM
Sound Card problem(every time i install linux i have diffirent hardware problem) jacka1l Linux - Newbie 7 08-11-2005 06:10 AM
Lan configuration problem - NFS boot problem - RX&TX packets errors 242VDM242 Linux - Networking 4 11-25-2004 01:35 PM
perl problem? apache problem? cgi problem? WorldBuilder Linux - Software 1 09-17-2003 07:45 PM


All times are GMT -5. The time now is 12:05 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration