SimonKagstrom / kcov

Code coverage tool for compiled programs, Python and Bash which uses debugging information to collect and report data without special compilation options
http://simonkagstrom.github.io/kcov/
GNU General Public License v2.0
712 stars 109 forks source link

Generating the lcov database format from kcov #360

Open dinkopehar opened 3 years ago

dinkopehar commented 3 years ago

Hello.

While using kcov, I noticed it produces several formats of coverage. Is there a way to produce lcov style coverge report using kcov ?

Thank you.

SimonKagstrom commented 3 years ago

Well, it was originally meant to produce just that. I think the color-scheme is slightly different, but otherwise it should be basically the same. There are some things in lcov/gcov which are difficult to support with kcov, since it doesn't do branch coverage.

Or is there some other feature you're looking for? I'll admit I'm not really up-to-date with lcov, haven't been using it for 10 years or so :-)

dinkopehar commented 3 years ago

I noticed kcov produces "sonarqube" file and cobertura.xml which is compatible with Java Projects and Jenkins coverage. Lot of other projects rely on lcov format file. For example, coveralls.io only supports upload in lcov format (I understand that kcov can upload manually, but I had some problems with it running from GitHub. ) Also, many coverage tools in other languages create this lcov report, so extensions for VSCode can display coverage inside gutters of editor from that lcov report.

SimonKagstrom commented 3 years ago

Yes, that would be a good reason. I understand what you mean now, so it's the database format itself, and not the HTML reports which are needed.

I'll rename this issue to something like that.

As for vscode, I use coverage gutters with kcov. It supports cobertura, so I just make sure to copy the cobertura.xml / cov.xml to the .vscode-directory and then it works out of the box. The file needs to be named cov.xml.

dinkopehar commented 3 years ago

As for vscode, I use coverage gutters with kcov. It supports cobertura, so I just make sure to copy the cobertura.xml / cov.xml to the .vscode-directory and then it works out of the box. The file needs to be named cov.xml.

Oh, great. Scratch this one then. I also have gutters displayed in red and green now in VS Code.

SimonKagstrom commented 3 years ago

It can be useful anyway, so I'll keep it open. Not sure when I'll get round to it though (hey, real work takes time it seems! :-)).

Off-topic question: For me, coverage gutters displays really slowly, have you managed to workaround that some way? I've seen bug reports in the coverage gutters github project about it, but it seems unconclusive to me.

dinkopehar commented 3 years ago

It can be useful anyway, so I'll keep it open. Not sure when I'll get round to it though (hey, real work takes time it seems! :-)).

I know. You did amazing job on this one, I don't even know where would I start with this :smile_cat: .

Off-topic question: For me, coverage gutters displays really slowly, have you managed to workaround that some way? I've seen bug reports in the coverage gutters github project about it, but it seems unconclusive to me.

Well, I'm using kcov with crystal language. I use kcov to instrument generated binary. The output is in coverage directory at the root of project I'm working on. It wasn't slow for me in VSCode using coverage-gutters extension. Everything is displayed in timely manner. I can recommend to:

Personally for me wasn't slow, I only use option to display coverage, I don't use Coverage Guttes: Watch to have it constantly read if coverage file change. Maybe setting everything to exact path of generated report instead of leaving it as wildcard (**) can speed things up :confused: