diff options
Diffstat (limited to 'src/cmd/go/testflag.go')
-rw-r--r-- | src/cmd/go/testflag.go | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/cmd/go/testflag.go b/src/cmd/go/testflag.go index aea81d8f8..73f311e5f 100644 --- a/src/cmd/go/testflag.go +++ b/src/cmd/go/testflag.go @@ -66,7 +66,6 @@ var testFlagDefn = []*testFlagSpec{ // local. {name: "c", boolVar: &testC}, {name: "file", multiOK: true}, - {name: "i", boolVar: &testI}, {name: "cover", boolVar: &testCover}, {name: "coverpkg"}, @@ -75,8 +74,11 @@ var testFlagDefn = []*testFlagSpec{ {name: "n", boolVar: &buildN}, {name: "p"}, {name: "x", boolVar: &buildX}, + {name: "i", boolVar: &buildI}, {name: "work", boolVar: &buildWork}, + {name: "ccflags"}, {name: "gcflags"}, + {name: "exec"}, {name: "ldflags"}, {name: "gccgoflags"}, {name: "tags"}, @@ -116,7 +118,6 @@ var testFlagDefn = []*testFlagSpec{ func testFlags(args []string) (packageNames, passToTest []string) { inPkg := false outputDir := "" - testCoverMode = "set" for i := 0; i < len(args); i++ { if !strings.HasPrefix(args[i], "-") { if !inPkg && packageNames == nil { @@ -154,6 +155,16 @@ func testFlags(args []string) (packageNames, passToTest []string) { setBoolFlag(f.boolVar, value) case "p": setIntFlag(&buildP, value) + case "exec": + execCmd, err = splitQuotedFields(value) + if err != nil { + fatalf("invalid flag argument for -%s: %v", f.name, err) + } + case "ccflags": + buildCcflags, err = splitQuotedFields(value) + if err != nil { + fatalf("invalid flag argument for -%s: %v", f.name, err) + } case "gcflags": buildGcflags, err = splitQuotedFields(value) if err != nil { @@ -212,6 +223,14 @@ func testFlags(args []string) (packageNames, passToTest []string) { } } + if testCoverMode == "" { + testCoverMode = "set" + if buildRace { + // Default coverage mode is atomic when -race is set. + testCoverMode = "atomic" + } + } + // Tell the test what directory we're running in, so it can write the profiles there. if testProfile && outputDir == "" { dir, err := os.Getwd() |