aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing.go')
-rw-r--r--src/testing/testing.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/testing/testing.go b/src/testing/testing.go
index 1dcc35ebc0..6237da9abd 100644
--- a/src/testing/testing.go
+++ b/src/testing/testing.go
@@ -485,7 +485,11 @@ func MainStart(matchString func(pat, str string) (bool, error), tests []Internal
// Run runs the tests. It returns an exit code to pass to os.Exit.
func (m *M) Run() int {
- flag.Parse()
+ // TestMain may have already called flag.Parse.
+ if !flag.Parsed() {
+ flag.Parse()
+ }
+
parseCpuList()
before()