cmd/go: write coverage to file, add percentage statistic

Move the data dumper to the testing package, where it has access
to file I/O.
Print a percentage value at the end of the run.

R=rsc, adg
CC=golang-dev
https://golang.org/cl/10264045
This commit is contained in:
Rob Pike 2013-06-18 14:18:25 -07:00
parent 6154ae8e24
commit 8e8b8b85c2
4 changed files with 124 additions and 43 deletions

View file

@ -122,6 +122,8 @@ var (
// Report as tests are run; default is silent for success.
chatty = flag.Bool("test.v", false, "verbose: print additional output")
cover = flag.String("test.cover", "", "cover mode: set, count, atomic; default is none")
coverProfile = flag.String("test.coverprofile", "", "write a coveraage profile to the named file after execution")
match = flag.String("test.run", "", "regular expression to select tests and examples to run")
memProfile = flag.String("test.memprofile", "", "write a memory profile to the named file after execution")
memProfileRate = flag.Int("test.memprofilerate", 0, "if >=0, sets runtime.MemProfileRate")
@ -518,6 +520,9 @@ func after() {
}
f.Close()
}
if *cover != "" {
coverReport()
}
}
// toOutputDir returns the file name relocated, if required, to outputDir.