-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support code coverage when testing #352
Comments
Based on my unpleasant experience with gcov (GCC coverage tool) in foolish drive for 100% coverage: there should be some easy way to label certain lines or whole functions as "doesn't need coverage". All kinds of unlikely situations, impossible to emulate. gcov doesn't support anything like this, so I write a tool which scanned all C source files, searched for "no coverage" tags and removed these lines from gcov output. It looked like:
There should be also some way to skip coverage checking for 3pp libraries, w/o touching their source code. |
Just though I'd mention that kcov works perfectly as is with zig at the moment. I think coverage in general is slightly more useful than it normally would be for zig as well, since it clearly shows what segments of code were never compiled. This helps with compile-time evaluation heavy bits. Only steps required are:
|
Oh that's really interesting with the defers in yellow. The number tells you how many different ways there were to exit the block, and it only goes green if you manage to hit them all (in this case by having each The defer thing might change with #283 |
I tried this using
but in the coverage report I see no coverage: I wonder what's going on here. |
Looking forward to this option 🚀 |
kcov still works, the instructions have changed slightly as
It is very slow on my M1 Macbook Air. Took over 5 minutes. |
It would be interesting to generate a coverage report based on the
*(kcov seems to provide everything that's necessary for this) |
In https://www.youtube.com/watch?v=1QMHbp5LUKg Simon Kagstrom says that he found that debugging information is often broken on Linux systems, because |
Add a
--coverage
argument tozig test
and have it generate a nice report.Related:
The text was updated successfully, but these errors were encountered: