diff options
| author | Russ Cox <rsc@golang.org> | 2017-07-17 21:06:05 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2017-10-10 17:44:22 +0000 |
| commit | 3a8b9cfe9138d3a4aa227a6967d94ecdb3c0bd6f (patch) | |
| tree | d24479b6e33dc06bfea80f64006a617057da9bb6 /src/testing/testing.go | |
| parent | f14f7b31416ee655dc588eb3a1772a7a4be2a61c (diff) | |
| download | go-3a8b9cfe9138d3a4aa227a6967d94ecdb3c0bd6f.tar.xz | |
testing: add PAUSE, CONT output lines to explain Parallel execution
This should make parallel execution a bit clearer.
With -p=1 it should make the execution completely unambiguous.
Fixes #19280.
Change-Id: Ib48cdfe96896d01b0d8f98ccb2fab614407a7d92
Reviewed-on: https://go-review.googlesource.com/49430
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/testing/testing.go')
| -rw-r--r-- | src/testing/testing.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/testing/testing.go b/src/testing/testing.go index a170cd0fd9..4beb9c6c1c 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -675,9 +675,30 @@ func (t *T) Parallel() { t.parent.sub = append(t.parent.sub, t) t.raceErrors += race.Errors() + if t.chatty { + // Print directly to root's io.Writer so there is no delay. + root := t.parent + for ; root.parent != nil; root = root.parent { + } + root.mu.Lock() + fmt.Fprintf(root.w, "=== PAUSE %s\n", t.name) + root.mu.Unlock() + } + t.signal <- true // Release calling test. <-t.parent.barrier // Wait for the parent test to complete. t.context.waitParallel() + + if t.chatty { + // Print directly to root's io.Writer so there is no delay. + root := t.parent + for ; root.parent != nil; root = root.parent { + } + root.mu.Lock() + fmt.Fprintf(root.w, "=== CONT %s\n", t.name) + root.mu.Unlock() + } + t.start = time.Now() t.raceErrors += -race.Errors() } |
