kcov icon indicating copy to clipboard operation
kcov copied to clipboard

Generating the lcov database format from kcov

Open dinkopehar opened this issue 4 years ago • 6 comments

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.

dinkopehar avatar Jun 10 '21 14:06 dinkopehar

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 :-)

SimonKagstrom avatar Jun 12 '21 14:06 SimonKagstrom

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.

dinkopehar avatar Jun 15 '21 09:06 dinkopehar

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.

SimonKagstrom avatar Jun 18 '21 06:06 SimonKagstrom

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.

dinkopehar avatar Jun 22 '21 09:06 dinkopehar

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.

SimonKagstrom avatar Jun 23 '21 08:06 SimonKagstrom

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:

  • Set Coverage File names to files you are looking for:
    "coverage-gutters.coverageFileNames": [
          "cov.xml",
          "coverage.xml",
      ]
    
  • Coverage Report File Name set to: coverage/index.html
  • And most importantly, set paths that will be ignored by coverage-gutters extensions traversals:
    "coverage-gutters.ignoredPathGlobs": "**/{node_modules,venv,.venv,vendor,lib,bin}/**"
    

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:

dinkopehar avatar Jun 23 '21 09:06 dinkopehar