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

Ticket #3902 (closed defect: duplicate)

Opened 3 years ago

Last modified 2 years ago

I always get "Gathered coveraged data for 0 files"

Reported by: janieto@… Owned by: jdsiiro
Priority: normal Milestone:
Component: gcovr Version:
Keywords: Cc:

Description

I am trying use gcovr to generate xml file, but I always get 'Gathered coverage data for 0 file'
If I run "gcovr -r . -v", I'll see that it running gvoc for three files (*.gcda) but I never get any information in the report.
Could somebody help me?
Thank

Attachments

PrjFracTest.tar Download (50.0 KB) - added by anonymous 3 years ago.
gcov.release Download (264 bytes) - added by janieto@… 3 years ago.
Release fo gcov

Change History

comment:1 Changed 3 years ago by jdsiiro

Can you submit a (hopefully minimal) example that reproduces the problem?

In particular, gcov is very sensitive to what directory it is run from. Can you provide a sense of your directory layout, how you are building & running your code, and where you are running gcovr?

comment:2 follow-up: ↓ 3 Changed 3 years ago by janieto@…

The makefile is:

# CppUnit?-Tutorial
# file: makefile
# next line has to be changed to the installation-path of CppUnit?
CPPUNIT_PATH=/usr/local/lib

ftest: ftest.o fractiontest.o Fraction.o

gcc -fprofile-arcs -ftest-coverage -o ftest ftest.o fractiontest.o Fraction.o -L${CPPUNIT_PATH}/lib -lstdc++ -lcppunit -ldl -lgcov

Fraction.o: Fraction.cc Fraction.h

gcc -fprofile-arcs -ftest-coverage -c Fraction.cc

fractiontest.o: fractiontest.cc

gcc -fprofile-arcs -ftest-coverage -c fractiontest.cc -I${CPPUNIT_PATH}/include

ftest.o: ftest.cc

gcc -fprofile-arcs -ftest-coverage -c ftest.cc -I${CPPUNIT_PATH}/include

clean:

rm -f *.o *.gcov *.gcda *.gcno

and when I run 'gcovr -r . -v, I get:

Scanning directory . for gcda files...
Found 6 files
Running gcov: 'gcov /home/jnieto/.jenkins/jobs/FractionTest/workspace/view_fraction_jenkins/Unix-vob/src/PrjFracTest/ftest.gcda --branch-counts --branch-probabilities --preserve-paths --object-directory /home/jnieto/.jenkins/jobs/FractionTest/workspace/view_fraction_jenkins/Unix-vob/src/PrjFracTest' in '/home/jnieto/.jenkins/jobs/FractionTest/workspace/view_fraction_jenkins/Unix-vob/src/PrjFracTest'
Running gcov: 'gcov /home/jnieto/.jenkins/jobs/FractionTest/workspace/view_fraction_jenkins/Unix-vob/src/PrjFracTest/fractiontest.gcda --branch-counts --branch-probabilities --preserve-paths --object-directory /home/jnieto/.jenkins/jobs/FractionTest/workspace/view_fraction_jenkins/Unix-vob/src/PrjFracTest' in '/home/jnieto/.jenkins/jobs/FractionTest/workspace/view_fraction_jenkins/Unix-vob/src/PrjFracTest'
Running gcov: 'gcov /home/jnieto/.jenkins/jobs/FractionTest/workspace/view_fraction_jenkins/Unix-vob/src/PrjFracTest/Fraction.gcda --branch-counts --branch-probabilities --preserve-paths --object-directory /home/jnieto/.jenkins/jobs/FractionTest/workspace/view_fraction_jenkins/Unix-vob/src/PrjFracTest' in '/home/jnieto/.jenkins/jobs/FractionTest/workspace/view_fraction_jenkins/Unix-vob/src/PrjFracTest'
Running gcov: 'gcov /home/jnieto/.jenkins/jobs/FractionTest/workspace/view_fraction_jenkins/Unix-vob/src/PrjFracTest/linux/ftest.gcda --branch-counts --branch-probabilities --preserve-paths --object-directory /home/jnieto/.jenkins/jobs/FractionTest/workspace/view_fraction_jenkins/Unix-vob/src/PrjFracTest/linux' in '/home/jnieto/.jenkins/jobs/FractionTest/workspace/view_fraction_jenkins/Unix-vob/src/PrjFracTest/linux'
Running gcov: 'gcov /home/jnieto/.jenkins/jobs/FractionTest/workspace/view_fraction_jenkins/Unix-vob/src/PrjFracTest/linux/fractiontest.gcda --branch-counts --branch-probabilities --preserve-paths --object-directory /home/jnieto/.jenkins/jobs/FractionTest/workspace/view_fraction_jenkins/Unix-vob/src/PrjFracTest/linux' in '/home/jnieto/.jenkins/jobs/FractionTest/workspace/view_fraction_jenkins/Unix-vob/src/PrjFracTest/linux'
Running gcov: 'gcov /home/jnieto/.jenkins/jobs/FractionTest/workspace/view_fraction_jenkins/Unix-vob/src/PrjFracTest/linux/Fraction.gcda --branch-counts --branch-probabilities --preserve-paths --object-directory /home/jnieto/.jenkins/jobs/FractionTest/workspace/view_fraction_jenkins/Unix-vob/src/PrjFracTest/linux' in '/home/jnieto/.jenkins/jobs/FractionTest/workspace/view_fraction_jenkins/Unix-vob/src/PrjFracTest/linux'
Gathered coveraged data for 0 files


File Lines Exec Cover Missing



TOTAL 0 0 --%


If you think that you need more information, I'll be able submit the source files.
Thanks

comment:3 in reply to: ↑ 2 Changed 3 years ago by jdsiiro

I suspect your problem might be using the wrong compiler: gcc is the general frontend, and based on your use of CppUnit and the .cc extension, it looks like your code is C++. While gcc will eventually invoke cc1plus behind-the-scenes, it does so with different default settings than the g++ frontend. Can you try changing your makefile to use g++, cleaning, rebuilding, and re-running and see if that makes any difference?

Replying to janieto@…:

If you think that you need more information, I'll be able submit the source files.
Thanks

If that doesn't fix it, then the next step would be for me to try and replicate things here. For that, a tarball of the source, etc. would me most helpful. If you do not feel comfortable posting it to this site, you can e-mail it directly to me (same user name @sandia.gov). Also, what OS (and version) are you using, and what version of gcov and gcc/g++?

Changed 3 years ago by anonymous

Changed 3 years ago by janieto@…

Release fo gcov

comment:4 Changed 3 years ago by anonymous

I tried it, but it doesn't fix. Then I will send three files with the proyect and the gcov release gcc release.
You will have to install cppunit if you want to make the proyect.
The cppunit version is cppunit-1.12.1
Thank

comment:5 Changed 3 years ago by jdsiiro

Alas, the example you uploaded works perfectly for me:

77 ~/test  % tar -xf PrjFracTest.tar 
78 ~/test  % cd PrjFracTest
79 ~/test/PrjFracTest  % make
g++ -fprofile-arcs -ftest-coverage -c ftest.cc -I/usr/local/lib/include
g++ -fprofile-arcs -ftest-coverage -c fractiontest.cc -I/usr/local/lib/include
g++ -fprofile-arcs -ftest-coverage -c Fraction.cc 
g++ -fprofile-arcs -ftest-coverage -o ftest ftest.o fractiontest.o Fraction.o -L/usr/local/lib/lib -lstdc++ -lcppunit -ldl -lgcov
80 ~/test/PrjFracTest  % ./ftest 
fractiontest::addTest : OK
fractiontest::subTest : OK
fractiontest::exceptionTest : OK
fractiontest::equalTest : OK
81 ~/test/PrjFracTest  % ./gcovr -r .
------------------------------------------------------------------------------
File                                       Lines    Exec  Cover   Missing
------------------------------------------------------------------------------
Fraction.cc                                   49      39    79%   44-54,93-95
fractiontest.cc                               42      42   100%   
fractiontest.h                                 7       7   100%   
ftest.cc                                      15      15   100%   
------------------------------------------------------------------------------
TOTAL                                        113     103    91%
------------------------------------------------------------------------------

I am running:

  • RHEL 5.5
  • gcc 4.1.2
  • cppunit 1.12.0

Looking at your Jenkins output above, it looks like you have a weird state for your workspace: gcovr is picking up 2 instances of each gcda file: 1 in PrjFracTest and 1 in PrjFracTest/linux. Your uploaded example has no linux directory. Those redundant gcda files may be confusing things, but I really don't know why.

comment:6 follow-up: ↓ 7 Changed 3 years ago by janieto@…

In the proyect that I sent I clean some directories and I put all files in the same directory, but it doesn't work.
What version do you have of gcov ?

comment:7 in reply to: ↑ 6 Changed 3 years ago by jdsiiro

Replying to janieto@…:

In the proyect that I sent I clean some directories and I put all files in the same directory, but it doesn't work.

As I mentioned earlier, gcov is very sensitive to directory layout and the current working directory. If you run the same steps as I did above (but please add -v to the gcovr command line) using the tarball you uploaded in a clean directory, what do you get?

What version do you have of gcov ?

gcov (GCC) 4.1.2 20080704 (Red Hat 4.1.2-50)

(It's part of the GCC suite, so the version matches the gcc compiler.)

comment:8 follow-up: ↓ 9 Changed 3 years ago by janieto@…

Is it important the phyton version ?
I am running Phyton 2.4.3

comment:9 in reply to: ↑ 8 Changed 3 years ago by jdsiiro

Replying to janieto@…:

Is it important the phyton version ?
I am running Phyton 2.4.3

I believe 2.4 is the minimum version (I am also running 2.4.3).

comment:10 Changed 3 years ago by janieto@…

If you run 'LANG=C ./gcovr -r . ', gcovr run right although your O.S. language is spanish.

comment:11 Changed 3 years ago by jdsiiro

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

OK - this sounds like a duplicate of #3898.

comment:12 Changed 2 years ago by jdsiiro

Referenced in changeset [2760]:

Force gcov to run with LC_ALL = en_US. This should guarantee that the output is in English, even when run in non-English locales.

Fixes #3898 (and #3902).

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.