Reputation: 11
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.
Upvotes: 1
Views: 1143
Reputation: 1088
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.
Upvotes: 0
Reputation: 127
May be this question will help you resolve the issue.
GCOVR giving empty results zero percent in MAC
Upvotes: 0
Reputation: 17471
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.
Upvotes: 2