binhonglee / coco

Code coverage for Nim lang (CLI + library)
MIT License
46 stars 3 forks source link

code coverage should use compiler support #19

Open timotheecour opened 4 years ago

timotheecour commented 4 years ago

@samuelroy In light of things like https://github.com/samuelroy/coco/issues/13, I think we can do much better and 100% accuracy (maybe) by using compiler support (via instrumentation of the nim code directly) instead of lcov based approach. Let me know if you'd be interested in exploring that approach, happy to help; I think it's very doable. Code coverage is a very useful basic feature that helps with many things, eg testing, finding bugs, improving code quality in general, so it's an important feature nim should have

implementation details

I think looking at optProfiler in nim code (enabled by nim --profiler:on) should be a good starting point

EDIT

see https://forum.nim-lang.org/t/7024#44128 where I detail what I've worked on (tracing)

samuelroy commented 4 years ago

I've already looked at implementing my own profiler based on how nimprof works with no success so far. The profiler seems to work only in a sampling mode. Do you have a working example of code instrumentation with Nim?