Bug #1869
closedCobertura does not show source code
100%
Description
Steps to reproduce:
- submit a Job to Jenkins, and wait for it to succeed
(if Job is failing, fix the compilation and unit testing problem, and try again) - visit Cobertura Coverage Report for
daemon/table/fib.hpp
Expected: the report displays the source code of daemon/table/fib.hpp
, and highlights which lines are not covered by unit testing.
Actual: the report only displays the percentage of lines covered by unit testing, which is useless for the purpose of improving unit testing.
Files
Updated by Junxiao Shi over 10 years ago
One related problem is that, the report shows only .hpp files, and does not show .cpp files.
Updated by Yi Huang over 10 years ago
- Status changed from New to In Progress
That looks weird. I'll try to solve it.
Updated by Yi Huang over 10 years ago
I suspect gcovr is not generating the right report. I will need to dive deeper on this issue. Unfortunately I am not available until Monday 8/25. If this is not very urgent I'll continue to look at this issue on 8/25.
Updated by Junxiao Shi over 10 years ago
This is not urgent. Work on it whenever you have time.
Updated by Junxiao Shi about 10 years ago
Is there any progress on this? This is necessary to improve code coverage.
Updated by Yi Huang about 10 years ago
Not yet I was working on cross compiling NFD on android devices these days.
Updated by Junxiao Shi about 10 years ago
Is there any progress on this? This is necessary to improve code coverage.
Updated by Yi Huang about 10 years ago
- % Done changed from 0 to 30
I don't think I have time to work on this issue soon. Therefore I'm reporting what I have investigated so far for whom is interested to look into this issue.
Waf uses those flags to build NFD when "--with-coverage" is specified by Jenkins:
-fprofile-arcs -ftest-coverage -fPIC
These options are identical to the ones they used on gcovr user guide: http://gcovr.com/guide.html
Then once the project is built, Jenkins runs unit tests. Since project is build with the coverage options above, running unit tests will generate some ".gcno" and ".gcda" files. I think they are correctly generated (I was manually reproduce this issue).
Then Jenkins will run the following command to generate coverage report:
gcovr -r . --object-directory=build/ -x -o build/coverage.xml
I was trying to reproduce the issue manually. And I don't need the xml report. I just ran the following command so gcovr will directly display the report to console:
gcovr -r . --object-directory=build/
However, in the report created by gcovr, there are only coverage information for hpp files. Because of this, Cobertura is not able to display the result of cpp files.
Updated by Alex Afanasyev about 10 years ago
- Status changed from In Progress to Resolved
- Assignee changed from Yi Huang to Alex Afanasyev
Updated by Alex Afanasyev about 10 years ago
The basic problem that I discovered was that the coverage command (gcovr
) should run from the same directory as the compiler. In our case, all compilation happens inside build/
folder. The result of not running gcovr
being in build/
folder prevents finding .cpp
files (names of the files gcov
was looking for was like ../daemon/xxx
).
I have fixed the command on jenkins, adding additional filters to analyze only daemon/
, core/
, and rib/
folders. Previously our report was also incorrectly showing websocketpp
, tools
and other folders with source files.
Updated by Junxiao Shi about 10 years ago
The bug fix is incomplete.
Although .cpp files are listed in the report, all files in the report still show "Source code is unavailable. Some possible reasons are:".
Updated by Alex Afanasyev about 10 years ago
I haven't fixed things with ndn-cxx repo, but there are currently no problems with NFD reports. I can see source code for hpp and cpp files... Can you give example where it's not working?
This shows me content of fib.hpp
and hightlights some lines, though I don't have much clue what is the logic for this highlighting.
Updated by Alex Afanasyev about 10 years ago
Apparently, the plugin has some strange retention policy for source code. It claims that it has code only for the most recent build.
I just observed code "disappear" while the most recent build fail. The code reappear after I retried the job.
Updated by Junxiao Shi about 10 years ago
As of Oct 08 01:13 UTC, the latest build of NFD is build 1689 and is successful, however daemon/table/cs.cpp does not have source code.
Please change retention policy to: retain the last 5 successful builds for each project.
Updated by Alex Afanasyev about 10 years ago
Hmm. I see the code... (attached my screenshot)
Updated by Junxiao Shi about 10 years ago
Some possible reasons are: You do not have sufficient permissions to view this file.
Please ensure anyone who has logged in to Jenkins can view the source code.
Updated by Alex Afanasyev about 10 years ago
- % Done changed from 30 to 100
Permissions should be correct now. I have no idea how to preserve multiple sources. The plugin doesn't have such a parameter and my 10-minute google didn't find anything useful. I declare this task done.