1

When I execute the gcovr file from within my folder containing the .gcno & .gcda files, the coverage.xml file is being generated.

Folder Location - /Users//….. /x86_64/

Gcovr Location - /Users//….. /x86_64/gcovr

Current Location - /Users//….. /x86_64/

Command - python gcovr –x > coverage.xml

The coverage files contains the code coverage report.

BUT, if I call the same executable from a remote location Ex.

Current Location - /Users/

Gcovr Location - /Users//….. /x86_64/gcovr

Command - python /Users//….. /x86_64/gcovr –r /Users//….. /x86_64/ –x > coverage.xml

Also, same is the case when I have gcovr on a remote location and call it for the root folder of my coverage files.

Current Location - /Users/

Gcovr Location - /Users//gcovr

Command - python /Users//gcovr –r /Users//….. /x86_64/ –x > coverage.xml

The coverage file does not contain the coverage report. It looks like this

<?xml version="1.0" ?>
<!DOCTYPE coverage
  SYSTEM 'http://cobertura.sourceforge.net/xml/coverage-03.dtd'>
<coverage branch-rate="0.0" line-rate="0.0" timestamp="1365619556" version="gcovr 2.5-      prerelease (r2823)">
    <sources>
        <source>
            /Users/<username>/….. /x86_64/<Code Coverage Files>
        </source>
    </sources>
    <packages/>
</coverage>

Any help is greatly appreciated.

  • 1
    Looking at my gcovr lines, which work both on master and slave, I'm always executing from the build directory and pointing at the coverage/object directory in the command line. This seemed to be necessary for the source lines to be found. That might be worth a try – gaige Apr 13 '13 at 20:58
  • @gaige: You might want to add this as an answer, since this helped me too! – asgoth Jul 19 '13 at 06:40
  • @asgoth I have done so. Glad it was helpful. – gaige Jul 19 '13 at 10:27

3 Answers3

2

Looking at my gcovr lines, which work both on master and slave, I'm always executing from the build directory and pointing at the coverage/object directory in the command line. This seemed to be necessary for the source lines to be found.

gaige
  • 17,263
  • 6
  • 57
  • 68
0

May be this question will help you resolve the issue.

GCOVR giving empty results zero percent in MAC

Community
  • 1
  • 1
0

Did you compile with following option? : -ftest-coverage -fprofile-arcs

Did you link with following option? : -fprofile-arcs

Here my way of excluding superfluous files:

gcovr --xml -e ".*unit-test.*\.cpp" -e ".*unit-test.*\.h" -e ".*usr/include/.*" -e ".*jenkins.*" -o coverage.xml

Remote files are always found correct, although I cannot open them from Jenkins.

Bart Mensfort
  • 995
  • 11
  • 21