Commit f034b62c authored by Russ Cox's avatar Russ Cox

testing: move comment inside T.Parallel

This was supposed to be in CL 18204 but I submitted from the web
instead of my computer and lost this final edit.

Change-Id: I41598e936bb088d77f5e44752eda74222a4208c7
Reviewed-on: https://go-review.googlesource.com/18310Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent aec2f0cf
...@@ -428,13 +428,14 @@ func (c *common) Skipped() bool { ...@@ -428,13 +428,14 @@ func (c *common) Skipped() bool {
// Parallel signals that this test is to be run in parallel with (and only with) // Parallel signals that this test is to be run in parallel with (and only with)
// other parallel tests. // other parallel tests.
func (t *T) Parallel() { func (t *T) Parallel() {
// We don't want to include the time we spend waiting for serial tests
// in the test duration. Record the elapsed time thus far and reset the
// timer afterwards.
if t.isParallel { if t.isParallel {
panic("testing: t.Parallel called multiple times") panic("testing: t.Parallel called multiple times")
} }
t.isParallel = true t.isParallel = true
// We don't want to include the time we spend waiting for serial tests
// in the test duration. Record the elapsed time thus far and reset the
// timer afterwards.
t.duration += time.Since(t.start) t.duration += time.Since(t.start)
t.signal <- (*T)(nil) // Release main testing loop t.signal <- (*T)(nil) // Release main testing loop
<-t.startParallel // Wait for serial tests to finish <-t.startParallel // Wait for serial tests to finish
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment