Than McIntosh has uploaded this change for review.
cmd/dist: add -cover flag
DO NOT SUBMIT
Add a "-cover" flag to the dist command, to enable collecting
code coverage from the equivalent of all.bash. Add a new
"cover.bash" script modeled after "race.bash".
Note:
- this patch still needs work, specifically cover.bash code
to set GOCOVERDIR, collect profiles afterwards
Change-Id: I3b185fa87b32b48addc65a84c9a7f5c1c03b9a14
---
M src/cmd/dist/test.go
A src/cover.bash
2 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go
index a540a2a..1186d30 100644
--- a/src/cmd/dist/test.go
+++ b/src/cmd/dist/test.go
@@ -33,6 +33,7 @@
flag.BoolVar(&noRebuild, "no-rebuild", false, "overrides -rebuild (historical dreg)")
flag.BoolVar(&t.keepGoing, "k", false, "keep going even when error occurred")
flag.BoolVar(&t.race, "race", false, "run in race builder mode (different set of tests)")
+ flag.BoolVar(&t.cover, "cover", false, "run in coverage testing mode")
flag.BoolVar(&t.compileOnly, "compile-only", false, "compile tests, but don't run them. This is for some builders. Not all dist tests respect this flag, but most do.")
flag.StringVar(&t.banner, "banner", "##### ", "banner prefix; blank means no section banners")
flag.StringVar(&t.runRxStr, "run", os.Getenv("GOTESTONLY"),
@@ -49,6 +50,7 @@
// tester executes cmdtest.
type tester struct {
race bool
+ cover bool
listMode bool
rebuild bool
failed bool
@@ -404,6 +406,9 @@
if t.race {
args = append(args, "-race")
}
+ if t.cover {
+ args = append(args, "-cover")
+ }
if t.compileOnly {
args = append(args, "-run=^$")
}
@@ -525,7 +530,7 @@
})
}
- if t.race {
+ if t.race || t.cover {
return
}
@@ -1624,7 +1629,7 @@
// a single argument.
// It returns an empty string if a pre-built binary should not be used.
func (t *tester) prebuiltGoPackageTestBinary() string {
- if len(stdMatches) != 1 || t.race || t.compileOnly || os.Getenv("GO_BUILDER_NAME") == "" {
+ if len(stdMatches) != 1 || t.race || t.cover || t.compileOnly || os.Getenv("GO_BUILDER_NAME") == "" {
return ""
}
pkg := stdMatches[0]
diff --git a/src/cover.bash b/src/cover.bash
new file mode 100644
index 0000000..ffdd7b6
--- /dev/null
+++ b/src/cover.bash
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+# Copyright 2013 The Go Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+
+set -e
+
+if [ ! -f make.bash ]; then
+ echo 'cover.bash must be run from $GOROOT/src' 1>&2
+ exit 1
+fi
+. ./make.bash --no-banner
+go install -cover cmd std
+# TODOs:
+# - fix hard-coded dist test rebuild of tools
+# - set GOCOVERDIR prior to run below
+go tool dist test -cover
To view, visit change 395897. To unsubscribe, or for help writing mail filters, visit settings.
Than McIntosh uploaded patch set #3 to this change.
cmd/dist: add -cover flag
DO NOT SUBMIT
Add a "-cover" flag to the dist command, to enable collecting
code coverage from the equivalent of all.bash. Add a new
"cover.bash" script modeled after "race.bash".
Note:
- this patch still needs work, specifically cover.bash code
to set GOCOVERDIR, collect profiles afterwards
Change-Id: I3b185fa87b32b48addc65a84c9a7f5c1c03b9a14
---
M src/cmd/dist/test.go
A src/cover.bash
2 files changed, 43 insertions(+), 2 deletions(-)
To view, visit change 395897. To unsubscribe, or for help writing mail filters, visit settings.
Patch set 4:Run-TryBot +1
Patch set 5:Run-TryBot +1
Patch set 7:Run-TryBot +1
Patch set 10:Run-TryBot +1
Patch set 11:Run-TryBot +1
Than McIntosh uploaded patch set #16 to this change.
cmd/dist: add -cover flag
DO NOT SUBMIT
Add a "-cover" flag to the dist command, to enable collecting
code coverage from the equivalent of all.bash. Add a new
"cover.bash" script modeled after "race.bash".
Note:
- this patch still needs work, specifically cover.bash code
to set GOCOVERDIR, collect profiles afterwards
Change-Id: I3b185fa87b32b48addc65a84c9a7f5c1c03b9a14
---
M src/cmd/dist/test.go
A src/cover.bash
2 files changed, 43 insertions(+), 2 deletions(-)
To view, visit change 395897. To unsubscribe, or for help writing mail filters, visit settings.
Than McIntosh uploaded patch set #17 to this change.
cmd/dist: add -cover flag
DO NOT SUBMIT
Add a "-cover" flag to the dist command, to enable collecting
code coverage from the equivalent of all.bash. Add a new
"cover.bash" script modeled after "race.bash".
Note:
- this patch still needs work, specifically cover.bash code
to set GOCOVERDIR, collect profiles afterwards
Change-Id: I3b185fa87b32b48addc65a84c9a7f5c1c03b9a14
---
M src/cmd/dist/test.go
A src/cover.bash
2 files changed, 43 insertions(+), 2 deletions(-)
To view, visit change 395897. To unsubscribe, or for help writing mail filters, visit settings.
Than McIntosh uploaded patch set #18 to this change.
cmd/dist: add -cover flag
DO NOT SUBMIT
Add a "-cover" flag to the dist command, to enable collecting
code coverage from the equivalent of all.bash. Add a new
"cover.bash" script modeled after "race.bash".
Note:
- this patch still needs work, specifically cover.bash code
to set GOCOVERDIR, collect profiles afterwards
Change-Id: I3b185fa87b32b48addc65a84c9a7f5c1c03b9a14
---
M src/cmd/dist/test.go
A src/cover.bash
2 files changed, 43 insertions(+), 2 deletions(-)
To view, visit change 395897. To unsubscribe, or for help writing mail filters, visit settings.
Patch set 18:Run-TryBot +1
Patch set 19:Run-TryBot +1
Patch set 22:Run-TryBot +1
Patch set 23:Run-TryBot +1
Patch set 34:Run-TryBot +1
Attention is currently required from: Than McIntosh.
Than McIntosh uploaded patch set #36 to this change.
cmd/dist: add -cover flag
DO NOT SUBMIT
Add a "-cover" flag to the dist command, to enable collecting
code coverage from the equivalent of all.bash. Add a new
"cover.bash" script modeled after "race.bash".
Note:
- this patch still needs work, specifically cover.bash code
to set GOCOVERDIR, collect profiles afterwards
Change-Id: I3b185fa87b32b48addc65a84c9a7f5c1c03b9a14
---
M src/cmd/dist/test.go
A src/cover.bash
2 files changed, 45 insertions(+), 2 deletions(-)
To view, visit change 395897. To unsubscribe, or for help writing mail filters, visit settings.
Patch set 38:Run-TryBot +1
1 comment:
Patchset:
TRY=linux-amd64-longtest,windows-amd64-longtest
To view, visit change 395897. To unsubscribe, or for help writing mail filters, visit settings.