Closed BotellaA closed 5 years ago
Hi!
No, I don't think it should be a lot of work. It seems like mostly the coverage tag has been changed, and at least lines-valid and lines-covered are available to kcov.
Great news! Do you plan on implementing this?
4fea834 should implement this, although I must admit it's untested so far. :-)
Leaving open until that's resolved.
I am starting to look at this issue again ;).
I run kcov on the same directory multiple times. Then I look at the cobertura.xml
output in kcov-merged
directory and it looks like this:
<?xml version="1.0" ?>
<!DOCTYPE coverage SYSTEM 'http://cobertura.sourceforge.net/xml/coverage-04.dtd'>
<coverage line-rate="0.000" version="1.9" timestamp="1558003992">
<sources>
<source>/home/vsts/work/1/s/</source>
</sources>
<packages>
<package name="test_vector" line-rate="0.000" lines-covered="0" lines-valid="0" branch-rate="1.0" complexity="1.0">
<classes>
<class name="structural_model_h" filename="include/geode/georepresentation/core/structural_model.h" line-rate="1.000">
<lines>
<line number="51" hits="1"/>
</lines>
</class>
<class name="component_type_h" filename="include/geode/georepresentation/core/component_type.h" line-rate="0.091">
<lines>
<line number="54" hits="0"/>
<line number="57" hits="0"/>
<line number="58" hits="0"/>
<line number="60" hits="1"/>
<line number="62" hits="0"/>
<line number="64" hits="0"/>
</lines>
</class>
</classes>
</package>
</packages>
</coverage>
I have two questions:
Thanks for your help
Does it look correct in the non-merged output? These should be filled in, but perhaps there is something in the merging which get's it incorrect.
The lines-covered in the coverage tag should be trivial to add, basically the same way as is done a few lines below https://github.com/SimonKagstrom/kcov/blob/master/src/writers/cobertura-writer.cc#L158. Feel free to submit a pull request for that :-)
If I run kcov on only one executable, I got no cobertura.xml
-rw-r--r-- 1 vsts docker 141 May 17 10:31 amber.png
-rw-r--r-- 1 vsts docker 2687 May 17 10:31 bcov.css
drwxr-xr-x 3 vsts docker 4096 May 17 10:31 data
-rw-r--r-- 1 vsts docker 167 May 17 10:31 glass.png
-rw-r--r-- 1 vsts docker 3816 May 17 10:31 index.html
-rw-r--r-- 1 vsts docker 465 May 17 10:31 index.js
drwxr-xr-x 2 vsts docker 4096 May 17 10:31 kcov-merged
-rw-r--r-- 1 vsts docker 13256 May 17 10:31 libkcov_sowrapper.so
lrwxrwxrwx 1 vsts docker 70 May 17 10:31 test-polygonal-surface -> /home/vsts/work/1/s/coverage//test-polygonal-surface.52880315c4f0b529/
drwxr-xr-x 4 vsts docker 20480 May 17 10:31 test-polygonal-surface.52880315c4f0b529
And the kcov-merged
folder is empty.
The cobertura.xml file should be in tests-polygonal-surface in this case, and on a single executable, there's nothing to merge so that's fine by itself :-)
Ok, so this is a piece of the file:
<?xml version="1.0" ?>
<!DOCTYPE coverage SYSTEM 'http://cobertura.sourceforge.net/xml/coverage-04.dtd'>
<coverage line-rate="0.000" version="1.9" timestamp="1558268139">
<sources>
<source>/home/vsts/work/1/s/</source>
</sources>
<packages>
<package name="test_polygonal_surface" line-rate="0.000" lines-covered="0" lines-valid="0" branch-rate="1.0" complexity="1.0">
<classes>
<class name="polyhedral_solid_input_cpp" filename="src/geode/mesh/io/polyhedral_solid_input.cpp" line-rate="0.000">
<lines>
<line number="39" hits="0"/>
<line number="46" hits="0"/>
<line number="47" hits="0"/>
<line number="49" hits="0"/>
<line number="51" hits="0"/>
<line number="52" hits="0"/>
<line number="53" hits="0"/>
<line number="55" hits="0"/>
<line number="58" hits="0"/>
<line number="60" hits="0"/>
<line number="62" hits="0"/>
<line number="63" hits="0"/>
</lines>
</class>
<class name="polyhedral_solid_output_h" filename="include/geode/mesh/io/polyhedral_solid_output.h" line-rate="0.000">
<lines>
<line number="57" hits="0"/>
</lines>
</class>
<class name="polygonal_surface_output_h" filename="include/geode/mesh/io/polygonal_surface_output.h" line-rate="1.000">
<lines>
<line number="57" hits="3"/>
</lines>
</class>
<class name="polygonal_surface_input_cpp" filename="src/geode/mesh/io/polygonal_surface_input.cpp" line-rate="0.667">
<lines>
<line number="39" hits="2"/>
<line number="47" hits="2"/>
<line number="48" hits="1"/>
<line number="50" hits="0"/>
<line number="52" hits="0"/>
<line number="53" hits="0"/>
<line number="54" hits="0"/>
<line number="56" hits="1"/>
<line number="59" hits="1"/>
<line number="61" hits="1"/>
<line number="63" hits="1"/>
<line number="64" hits="1"/>
</lines>
</class>
<class name="point_set_output_cpp" filename="src/geode/mesh/io/point_set_output.cpp" line-rate="0.333">
<lines>
<line number="39" hits="0"/>
<line number="45" hits="0"/>
<line number="46" hits="0"/>
<line number="48" hits="0"/>
<line number="50" hits="0"/>
<line number="51" hits="0"/>
<line number="52" hits="0"/>
<line number="54" hits="0"/>
<line number="57" hits="2"/>
<line number="59" hits="1"/>
<line number="61" hits="1"/>
<line number="62" hits="1"/>
</lines>
</class>
<class name="point_set_input_cpp" filename="src/geode/mesh/io/point_set_input.cpp" line-rate="0.333">
<lines>
<line number="39" hits="0"/>
<line number="45" hits="0"/>
<line number="46" hits="0"/>
<line number="48" hits="0"/>
<line number="50" hits="0"/>
<line number="51" hits="0"/>
<line number="52" hits="0"/>
<line number="54" hits="0"/>
<line number="57" hits="2"/>
<line number="59" hits="1"/>
<line number="61" hits="1"/>
<line number="62" hits="1"/>
</lines>
</class>
<class name="io_cpp" filename="src/geode/mesh/io/io.cpp" line-rate="1.000">
<lines>
<line number="37" hits="1"/>
<line number="38" hits="1"/>
<line number="39" hits="1"/>
</lines>
</class>
<class name="triangulated_surface_input_h" filename="include/geode/mesh/io/triangulated_surface_input.h" line-rate="0.000">
<lines>
<line number="57" hits="0"/>
</lines>
</class>
<class name="graph_output_cpp" filename="src/geode/mesh/io/graph_output.cpp" line-rate="0.000">
<lines>
<line number="39" hits="0"/>
<line number="43" hits="0"/>
<line number="44" hits="0"/>
<line number="46" hits="0"/>
<line number="48" hits="0"/>
<line number="49" hits="0"/>
<line number="51" hits="0"/>
<line number="53" hits="0"/>
<line number="54" hits="0"/>
<line number="56" hits="0"/>
<line number="57" hits="0"/>
</lines>
</class>
<class name="triangulated_surface_output_h" filename="include/geode/mesh/io/triangulated_surface_output.h" line-rate="0.000">
<lines>
<line number="57" hits="0"/>
</lines>
</class>
<class name="point_set_output_h" filename="include/geode/mesh/io/point_set_output.h" line-rate="1.000">
<lines>
<line number="56" hits="2"/>
</lines>
</class>
<class name="input_h" filename="include/geode/mesh/io/input.h" line-rate="1.000">
<lines>
<line number="39" hits="2"/>
<line number="45" hits="2"/>
</lines>
</class>
<class name="edged_curve_input_h" filename="include/geode/mesh/io/edged_curve_input.h" line-rate="0.000">
<lines>
<line number="56" hits="0"/>
</lines>
</class>
<class name="io_h" filename="include/geode/mesh/io/io.h" line-rate="1.000">
<lines>
<line number="44" hits="2"/>
<line number="46" hits="1"/>
<line number="48" hits="1"/>
<line number="49" hits="1"/>
<line number="52" hits="2"/>
</lines>
</class>
<class name="vertex_set_cpp" filename="src/geode/mesh/core/vertex_set.cpp" line-rate="1.000">
<lines>
<line number="40" hits="4"/>
<line number="43" hits="1"/>
<line number="45" hits="1"/>
<line number="46" hits="1"/>
<line number="51" hits="2"/>
<line number="53" hits="2"/>
<line number="54" hits="2"/>
<line number="60" hits="2"/>
<line number="62" hits="2"/>
<line number="65" hits="1"/>
<line number="66" hits="1"/>
<line number="67" hits="1"/>
<line number="70" hits="1"/>
<line number="71" hits="1"/>
<line number="72" hits="1"/>
<line number="75" hits="2"/>
<line number="77" hits="2"/>
<line number="78" hits="2"/>
</lines>
</class>
...
What do you think? It seems strange that all the global values are 0.0 in coverage and package tags.
I think you've found a regression, I'm fairly sure this worked before. I can reproduce it myself as well.
The problem is that the file->m_executedLines
and corresponding for code lines are set in writeOne
, so not available when getHeader
is called before. This part is a bit badly written I must confess, the writers themselves do the summing, but it would be better if that was available already before invocation.
I think this issue might be fixed with 3c78fcc, at least it looks OK now for my limited tests.
Could you add the support of the latest cobertura format coverage-04.dtd for xml output? I do not know if there is a lot to change.
Thanks.