-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
cgen,pref: add -coverage
support + vcover
tool
#21154
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work.
@felipensp, I've tested running this: if true {
println('branch 1')
if true {
println('branch 1.1')
if true {
println('branch 1.1.1')
} else {
println('branch 1.1.2')
}
} else {
println('branch 1.2')
if true {
println('branch 1.2.1')
} else {
println('branch 1.2.2')
}
}
} else {
println('branch 2')
if true {
println('branch 2.1')
if true {
println('branch 2.1.1')
} else {
println('branch 2.1.2')
}
} else {
println('branch 2.2')
if true {
println('branch 2.2.1')
} else {
println('branch 2.2.2')
}
}
} with:
Why does it print all the .v files for all modules (used in the program), given that for most programs, most of their functionality, will not be used? I think that skipping all the ones, for which there is 0 coverage will be more useful and more compact. |
I am planning to do:
|
The Windows gcc failure appears to be completely unrelated... and very, very weird:
|
-coverage
support-coverage
support + vcover
tool
It is my fault. It is fixed on master now. |
…/example1 for more isolated testing, independent of the contents of any vlib module in particular
…ta for the source files, containing the points, etc
…diagnostic); add condition_test.v, to test coverage by passing `-d condition1` to `-d condition7`
… /tmp/cover/ a.v`, restore runtime timestamp for the counter files
… they are put in generated C or generated JSON files
…ount/0 on windows and clock_gettime/2 everywhere else
…ntation of os.glob is less well tested and differs from the unix one, unlike os.walk_ext/2)
…nsistent behaviour of the tests
* master: cgen: fix array fixed initialization on struct from call (vlang#21568) testing: implement a separate `-show-asserts` option, for cleaner test output (`-stats` still works, and still shows both the compilation stats and the asserts) (vlang#21578) toml: fix `@[toml: ]`, support `@[skip]` (vlang#21571) os: fix debugger_present() for non Windows OSes (vlang#21573) builtin: simplify splint_nth methods (vlang#21563) net.http: change default http.Server listening address to :9009, to avoid conflicts with tools, that start their own http servers on 8080 like bytehound (vlang#21570) os: make minior improvement to C function semantics and related code (vlang#21565) io: cleanup prefix_and_suffix/1 util function (vlang#21562) os: remove mut declarions for unchanged vars in `os_nix.c.v` (vlang#21564) builtin: reduce allocations in s.index_kmp/1 and s.replace/2 (vlang#21561) ci: shorten path used for unix domain socket tests (to fit in Windows path limits)
Building with coverage support
v -cov ./dir-output file.v
or
v -cov ./dir-output run file.v
Every run of
./file
will generate acover.<build hash>.<time hash>.json
file.VCOVDIR
env variable can be used to change the output dir.VCOVDIR=/tmp/cover ./file
Reporting to stdout
Merging and reporting to stdout
v cov -dir ./coverage-dir
Test coverage
v -cov /tmp/cover test vlib/json/
v cover -dir /tmp/cover
Filtering results
v cover -dir /tmp/cover -filter vlib/json,vlib/toml