aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/test/testflag.go
diff options
context:
space:
mode:
authorBrandon Bennett <bbennett@fb.com>2017-04-20 10:26:10 -0600
committerMarcel van Lohuizen <mpvl@golang.org>2017-04-26 15:53:32 +0000
commitba8ff87dbeb87813a4604e36adb609b1e8fcb7be (patch)
tree515161a914c3b7a841bd095a1ed9300470466a65 /src/cmd/go/internal/test/testflag.go
parent6e2c4bc012f8cc262db25d3fee414c5231fea03a (diff)
downloadgo-ba8ff87dbeb87813a4604e36adb609b1e8fcb7be.tar.gz
go-ba8ff87dbeb87813a4604e36adb609b1e8fcb7be.zip
testing: add argument to list tests, benchmarks, and examples
Some large testing/build systems require some form of test discovery before running tests. This usually allows for analytics, history, and stats on a per tests basis. Typically these systems are meant used in multi-language environments and the original source code is not known or available. This adds a -test.list option which takes a regular expression as an argument. Any tests, benchmarks, or examples that match that regular expression will be printed, one per line, to stdout and then the program will exit. Since subtests are named/discovered at run time this will only show top-level tests names and is a known limitation. Fixes #17209 Change-Id: I7e607f5f4f084d623a1cae88a1f70e7d92b7f13e Reviewed-on: https://go-review.googlesource.com/41195 Reviewed-by: Marcel van Lohuizen <mpvl@golang.org> Run-TryBot: Marcel van Lohuizen <mpvl@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/cmd/go/internal/test/testflag.go')
-rw-r--r--src/cmd/go/internal/test/testflag.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cmd/go/internal/test/testflag.go b/src/cmd/go/internal/test/testflag.go
index 288156c819..fb76a34a77 100644
--- a/src/cmd/go/internal/test/testflag.go
+++ b/src/cmd/go/internal/test/testflag.go
@@ -42,6 +42,7 @@ var testFlagDefn = []*cmdflag.Defn{
{Name: "coverprofile", PassToTest: true},
{Name: "cpu", PassToTest: true},
{Name: "cpuprofile", PassToTest: true},
+ {Name: "list", PassToTest: true},
{Name: "memprofile", PassToTest: true},
{Name: "memprofilerate", PassToTest: true},
{Name: "blockprofile", PassToTest: true},
@@ -145,6 +146,8 @@ func testFlags(args []string) (packageNames, passToTest []string) {
case "bench":
// record that we saw the flag; don't care about the value
testBench = true
+ case "list":
+ testList = true
case "timeout":
testTimeout = value
case "blockprofile", "cpuprofile", "memprofile", "mutexprofile":