Permalink
Please sign in to comment.
Browse files
testing: add -failfast to go test
When -test.failfast flag is provided to go test, no new tests get started after the first failure. Fixes #21700 Change-Id: I0092e72f25847af05e7c8e1b811dcbb65a00cbe7 Reviewed-on: https://go-review.googlesource.com/74450 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
- Loading branch information...
Showing
with
125 additions
and 4 deletions.
- +3 −0 src/cmd/go/alldocs.go
- +44 −0 src/cmd/go/go_test.go
- +4 −1 src/cmd/go/internal/test/test.go
- +3 −2 src/cmd/go/internal/test/testflag.go
- +54 −0 src/cmd/go/testdata/src/failfast_test.go
- +17 −1 src/testing/testing.go
| @@ -0,0 +1,54 @@ | ||
| // Copyright 2017 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. | ||
| package failfast | ||
| import "testing" | ||
| func TestA(t *testing.T) { | ||
| // Edge-case testing, mixing unparallel tests too | ||
| t.Logf("LOG: %s", t.Name()) | ||
| } | ||
| func TestFailingA(t *testing.T) { | ||
| t.Errorf("FAIL - %s", t.Name()) | ||
| } | ||
| func TestB(t *testing.T) { | ||
| // Edge-case testing, mixing unparallel tests too | ||
| t.Logf("LOG: %s", t.Name()) | ||
| } | ||
| func TestParallelFailingA(t *testing.T) { | ||
| t.Parallel() | ||
| t.Errorf("FAIL - %s", t.Name()) | ||
| } | ||
| func TestParallelFailingB(t *testing.T) { | ||
| t.Parallel() | ||
| t.Errorf("FAIL - %s", t.Name()) | ||
| } | ||
| func TestParallelFailingSubtestsA(t *testing.T) { | ||
| t.Parallel() | ||
| t.Run("TestFailingSubtestsA1", func(t *testing.T) { | ||
| t.Errorf("FAIL - %s", t.Name()) | ||
| }) | ||
| t.Run("TestFailingSubtestsA2", func(t *testing.T) { | ||
| t.Errorf("FAIL - %s", t.Name()) | ||
| }) | ||
| } | ||
| func TestFailingSubtestsA(t *testing.T) { | ||
| t.Run("TestFailingSubtestsA1", func(t *testing.T) { | ||
| t.Errorf("FAIL - %s", t.Name()) | ||
| }) | ||
| t.Run("TestFailingSubtestsA2", func(t *testing.T) { | ||
| t.Errorf("FAIL - %s", t.Name()) | ||
| }) | ||
| } | ||
| func TestFailingB(t *testing.T) { | ||
| t.Errorf("FAIL - %s", t.Name()) | ||
| } |
0 comments on commit
153e409