Add code coverage functionality #11742
Replies: 3 comments 1 reply
-
This is the only feature preventing me from migrating to V as my main language |
Beta Was this translation helpful? Give feedback.
-
Is anyone working on this yet? I'm interested in figuring it out and at least starting to do something about it. |
Beta Was this translation helpful? Give feedback.
-
Not the expected implementation, just a result of my search for something, which would work right away :-) An alternative would be writing a V-native code coverage generation. For example, generating coverage data using gcov for stringify_test.v: v stringify_test.v -o stringify_test.c
gcc -fprofile-arcs -ftest-coverage -lgc stringify_test.c -o stringify_test
./stringify_test It will write out two binary files: stringify_test.gcda
stringify_test.gcno Which need some tool to translate it to humans like gcovr, for example: mkdir -p coverage
gcovr --html-nested coverage/index.html But with no source maps from C to V, like debugger uses underneath, the pure C analysis includes too much "foreign" code apart from the translated stringify.v: And a test method: And the implementation: So, like the debugger can do it, the lines with C functions and structures would need to be mapped to the V source code. The coverage metrics would need to be recomputed according to the V sources using include/exclude configuration based on the V source file and function names. And comments in sources like |
Beta Was this translation helpful? Give feedback.
-
http://www.semdesigns.com/Company/Publications/TestCoverage.pdf
Beta Was this translation helpful? Give feedback.
All reactions