Project

General

Profile

Actions

Bug #1869

closed

Cobertura does not show source code

Added by Junxiao Shi about 10 years ago. Updated about 10 years ago.

Status:
Closed
Priority:
Normal
Category:
Build
Target version:
Start date:
08/15/2014
Due date:
% Done:

100%

Estimated time:

Description

Steps to reproduce:

  1. 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)
  2. 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

Actions #1

Updated by Junxiao Shi about 10 years ago

One related problem is that, the report shows only .hpp files, and does not show .cpp files.

Actions #2

Updated by Yi Huang about 10 years ago

  • Status changed from New to In Progress

That looks weird. I'll try to solve it.

Actions #3

Updated by Yi Huang about 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.

Actions #4

Updated by Junxiao Shi about 10 years ago

This is not urgent. Work on it whenever you have time.

Actions #5

Updated by Junxiao Shi about 10 years ago

Is there any progress on this? This is necessary to improve code coverage.

Actions #6

Updated by Yi Huang about 10 years ago

Not yet I was working on cross compiling NFD on android devices these days.

Actions #7

Updated by Junxiao Shi about 10 years ago

Is there any progress on this? This is necessary to improve code coverage.

Actions #8

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.

Actions #9

Updated by Alex Afanasyev about 10 years ago

  • Status changed from In Progress to Resolved
  • Assignee changed from Yi Huang to Alex Afanasyev
Actions #10

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.

Actions #11

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:".

Actions #12

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.

Actions #13

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.

Actions #14

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.

Actions #15

Updated by Alex Afanasyev about 10 years ago

Hmm. I see the code... (attached my screenshot)

Actions #16

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.

Actions #17

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.

Actions #18

Updated by Junxiao Shi about 10 years ago

  • Status changed from Resolved to Closed

Verified.

Actions

Also available in: Atom PDF