Repository navigation
cmd/cover: should support -coverprofile unifying tests from multiple packages #6909
Description
Activity
It is not an urgent issue. The workaround is simple, please check the shell script: https://gist.github.com/hailiang/0f22736320abe6be71ce
Reacted by Harald Nordgren, atw527, Matt Braymer-Hayes, Landon Poch and rayjlindenCL https://golang.org/cl/159910044 mentions this issue.
Can this be included in 1.5. I don't see any technical reason for it to not be. Thank you.
- changed the title
[-]go.tools/cmd/cover: should support -coverprofile for multiple packages[/-][+]cmd/cover: should support -coverprofile for multiple packages[/+]on Feb 8, 2015 - As long as someone wants to work on this issue to solve it properly..... The mentioned CL is not the way to go (overwriting the cover profiles instead of combining them).
60 remaining items
@dnephin I like the approach, any thoughts on whether or not this would be considered?
@rsc I would be happy to work on this for 1.10, provided anything required by this is in place by then. Any guidance from you or anyone else would be good. Also this can have the
IDElabel as well.Reacted by Oleg Shalygin, Ce Gao, Alexey Palazhchenko, Hector Jusforgues, Guus van Weelden, Chris Reeves, Antoine GIRARD, Bahtiyar Biksayev, Egor, Toshiya Komoda and 9 moreReacted by Alan BraithwaiteReacted by Alexey Palazhchenko, Guus van Weelden, Chris Reeves, Bahtiyar Biksayev and Akshay ShahReacted by Alexey Palazhchenko, Guus van Weelden, Chris Reeves, Matt Boersma, Bahtiyar Biksayev and Damian MeeIn the mean time, I made another tool: https://github.com/AlekSi/gocoverutil. Unlike some bash scripts mentioned there, it sets exit status correctly if tests fail, it sets
-coverpkgto include all packages, etc.
But I'm really looking forward to retiring it when this issue and #21126 are closed.@rsc now that the build cache is in, are we closer to fix this bug? I think people are waiting here for some guidance on how to fix it. I can attempt something myself, but it would be great if you could provide some guidance. Thanks!
Reacted by Isaac de Andrade, Christian Höltje and Derek PerkinsMaybe a different way to see the problem is that we should have a different
covermodefor which we can apply this feature.For example, running
go test -coverprofile=coverage.out ./...should detect that the user wants to run in a recursive mode thus set thecovermodeto arecursive(or better named mode) in which, regardless of how many times a line is executed, it counts only as a simple boolean value (yes / no)?Of course, this could also be done in a more complex way, by storing which test hit which line and then, on a per-line basis, and then offer for each line of code touched by tests a slice of test names. It would then be up to the tools to read that information and display it to the users, in the most simplistic way doing this as described above with a simple yes / no mode.
Sorry for the double message.
The first suggestions is a great way to get this started. But the more powerful and resourceful
go test -converprofileis , the better.Change https://golang.org/cl/76875 mentions this issue:
cmd/go: allow -coverprofile with multiple packages being tested- changed the title
[-]x/tools/cmd/cover: should support -coverprofile unifying tests from multiple packages[/-][+]cmd/cover: should support -coverprofile unifying tests from multiple packages[/+]on Nov 10, 2017 - added a commit that references this issue
on Nov 1, 2018 - locked and limited conversation to collaborators
on Nov 10, 2018