mirror of
https://github.com/golang/go
synced 2024-11-24 21:00:09 -07:00
cmd/go: don't leave test binary around for coverage
It's not needed to analyze coverage data. Fixes #6120 R=golang-dev, adg CC=golang-dev https://golang.org/cl/13343050
This commit is contained in:
parent
1116f74e08
commit
6833d1b436
@ -269,7 +269,7 @@ List packages
|
|||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
|
|
||||||
go list [-e] [-f format] [-json] [-tags 'tag list'] [packages]
|
go list [-e] [-race] [-f format] [-json] [-tags 'tag list'] [packages]
|
||||||
|
|
||||||
List lists the packages named by the import paths, one per line.
|
List lists the packages named by the import paths, one per line.
|
||||||
|
|
||||||
@ -345,6 +345,9 @@ a non-nil Error field; other information may or may not be missing
|
|||||||
The -tags flag specifies a list of build tags, like in the 'go build'
|
The -tags flag specifies a list of build tags, like in the 'go build'
|
||||||
command.
|
command.
|
||||||
|
|
||||||
|
The -race flag causes the package data to include the dependencies
|
||||||
|
required by the race detector.
|
||||||
|
|
||||||
For more about specifying packages, see 'go help packages'.
|
For more about specifying packages, see 'go help packages'.
|
||||||
|
|
||||||
|
|
||||||
@ -809,8 +812,8 @@ will compile the test binary and then run it as
|
|||||||
|
|
||||||
pkg.test -test.v -test.cpuprofile=prof.out -dir=testdata -update
|
pkg.test -test.v -test.cpuprofile=prof.out -dir=testdata -update
|
||||||
|
|
||||||
The test flags that generate profiles also leave the test binary in pkg.test
|
The test flags that generate profiles (other than for coverage) also
|
||||||
for use when analyzing the profiles.
|
leave the test binary in pkg.test for use when analyzing the profiles.
|
||||||
|
|
||||||
Flags not recognized by 'go test' must be placed after any specified packages.
|
Flags not recognized by 'go test' must be placed after any specified packages.
|
||||||
|
|
||||||
|
@ -213,8 +213,8 @@ will compile the test binary and then run it as
|
|||||||
|
|
||||||
pkg.test -test.v -test.cpuprofile=prof.out -dir=testdata -update
|
pkg.test -test.v -test.cpuprofile=prof.out -dir=testdata -update
|
||||||
|
|
||||||
The test flags that generate profiles also leave the test binary in pkg.test
|
The test flags that generate profiles (other than for coverage) also
|
||||||
for use when analyzing the profiles.
|
leave the test binary in pkg.test for use when analyzing the profiles.
|
||||||
|
|
||||||
Flags not recognized by 'go test' must be placed after any specified packages.
|
Flags not recognized by 'go test' must be placed after any specified packages.
|
||||||
`,
|
`,
|
||||||
@ -272,6 +272,7 @@ var (
|
|||||||
testCoverPaths []string // -coverpkg flag
|
testCoverPaths []string // -coverpkg flag
|
||||||
testCoverPkgs []*Package // -coverpkg flag
|
testCoverPkgs []*Package // -coverpkg flag
|
||||||
testProfile bool // some profiling flag
|
testProfile bool // some profiling flag
|
||||||
|
testNeedBinary bool // profile needs to keep binary around
|
||||||
testI bool // -i flag
|
testI bool // -i flag
|
||||||
testV bool // -v flag
|
testV bool // -v flag
|
||||||
testFiles []string // -file flag(s) TODO: not respected
|
testFiles []string // -file flag(s) TODO: not respected
|
||||||
@ -728,7 +729,7 @@ func (b *builder) test(p *Package) (buildAction, runAction, printAction *action,
|
|||||||
a.target = filepath.Join(testDir, testBinary) + exeSuffix
|
a.target = filepath.Join(testDir, testBinary) + exeSuffix
|
||||||
pmainAction := a
|
pmainAction := a
|
||||||
|
|
||||||
if testC || testProfile {
|
if testC || testNeedBinary {
|
||||||
// -c or profiling flag: create action to copy binary to ./test.out.
|
// -c or profiling flag: create action to copy binary to ./test.out.
|
||||||
runAction = &action{
|
runAction = &action{
|
||||||
f: (*builder).install,
|
f: (*builder).install,
|
||||||
|
@ -181,6 +181,7 @@ func testFlags(args []string) (packageNames, passToTest []string) {
|
|||||||
testTimeout = value
|
testTimeout = value
|
||||||
case "blockprofile", "cpuprofile", "memprofile":
|
case "blockprofile", "cpuprofile", "memprofile":
|
||||||
testProfile = true
|
testProfile = true
|
||||||
|
testNeedBinary = true
|
||||||
case "coverpkg":
|
case "coverpkg":
|
||||||
testCover = true
|
testCover = true
|
||||||
if value == "" {
|
if value == "" {
|
||||||
|
Loading…
Reference in New Issue
Block a user