make -coverprofile include toolexec processes (#216)
testscript already included magic to also account for commands in the total code coverage. That does not happen with plain tests, since those only include coverage from the main test process. The main problem was that, before, indirectly executed commands did not properly save their coverage profile anywhere for testscript to collect it at the end. In other words, we only collected coverage from direct garble executions like "garble -help", but not indirect ones like "go build -toolexec=garble". $ go test -coverprofile=cover.out PASS coverage: 3.6% of statements total coverage: 16.6% of statements ok mvdan.cc/garble 6.453s After the delicate changes to testscript, any direct or indirect executions of commands all go through $PATH and properly count towards the total coverage: $ go test -coverprofile=cover.out PASS coverage: 3.6% of statements total coverage: 90.5% of statements ok mvdan.cc/garble 33.258s Note that we can also get rid of our code to set up $PATH, since testscript now does it for us. goversion.txt needed minor tweaks, since we no longer set up $WORK/.bin. Finally, note that we disable the reuse of $GOCACHE when collecting coverage information. This is to do "full builds", as otherwise the cached package builds would result in lower coverage. Fixes #35.pull/220/head
parent
e014f480f9
commit
1db6e1e230
Loading…
Reference in New Issue