summaryrefslogtreecommitdiff
path: root/src/pkg/testing
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2013-08-19 10:15:30 +1000
committerRob Pike <r@golang.org>2013-08-19 10:15:30 +1000
commita9d2de052261de6d2f9c7e23015a44c042d4c068 (patch)
tree5dee0f4e0a0842b7f79ec36617b4cf0df9d85513 /src/pkg/testing
parent51832a487a942d8eff9846d75a001aa28c8736b7 (diff)
downloadgo-a9d2de052261de6d2f9c7e23015a44c042d4c068.tar.gz
testing: don't start timing a Parallel test until it's actually starting
Fixes issue 5285. R=golang-dev, dvyukov CC=golang-dev https://codereview.appspot.com/13045044
Diffstat (limited to 'src/pkg/testing')
-rw-r--r--src/pkg/testing/testing.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/pkg/testing/testing.go b/src/pkg/testing/testing.go
index 4c81201a8..5019e0762 100644
--- a/src/pkg/testing/testing.go
+++ b/src/pkg/testing/testing.go
@@ -357,6 +357,9 @@ func (c *common) Skipped() bool {
func (t *T) Parallel() {
t.signal <- (*T)(nil) // Release main testing loop
<-t.startParallel // Wait for serial tests to finish
+ // Assuming Parallel is the first thing a test does, which is reasonable,
+ // reinitialize the test's start time because it's actually starting now.
+ t.start = time.Now()
}
// An internal type but exported because it is cross-package; part of the implementation
@@ -367,8 +370,6 @@ type InternalTest struct {
}
func tRunner(t *T, test *InternalTest) {
- t.start = time.Now()
-
// When this goroutine is done, either because test.F(t)
// returned normally or because a test failure triggered
// a call to runtime.Goexit, record the duration and send
@@ -384,6 +385,7 @@ func tRunner(t *T, test *InternalTest) {
t.signal <- t
}()
+ t.start = time.Now()
test.F(t)
}