go-internal icon indicating copy to clipboard operation
go-internal copied to clipboard

testscript: background cmds break -coverprofile

Open mvdan opened this issue 6 years ago • 2 comments

testscript tries to merge coverage profiles, but this is broken with background commands. It seems like the reason is that testscript expects the background cmd to write its coverage file immediately, not at the end of the test once it's interrupted.

mvdan avatar Jun 24 '19 08:06 mvdan

I am running into this issue at the moment as well: go test ./... -coverprofile=cov.out is causing command <cmd> failed to generate coverage information . Is this something that could be changed, or is unlikely to change?

Edit: After digging into mine some more, it looks like this only happens on an expected command failure ! <command>. I don't believe this is an issue nor is it related to this.

vishen avatar Oct 11 '20 02:10 vishen

I'm pretty sure this could be fixed, it just requires someone to refactor the code a bit to allow adding coverage info when background processes are cleaned up. Perhaps @rogpeppe has thoughts, since he wrote a lot of this code coverage merging logic.

mvdan avatar Oct 11 '20 18:10 mvdan