diff options
Diffstat (limited to 'src/testing/testing.go')
| -rw-r--r-- | src/testing/testing.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/testing/testing.go b/src/testing/testing.go index bd19a31c27..5efbc244fe 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -259,7 +259,7 @@ var ( // common holds the elements common between T and B and // captures common methods such as Errorf. type common struct { - mu sync.RWMutex // guards output, failed, and done. + mu sync.RWMutex // guards output, w, failed, and done. output []byte // Output generated by test or benchmark. w io.Writer // For flushToParent. chatty bool // A copy of the chatty flag. @@ -687,7 +687,9 @@ func (t *T) Run(name string, f func(t *T)) bool { root := t.parent for ; root.parent != nil; root = root.parent { } + root.mu.Lock() fmt.Fprintf(root.w, "=== RUN %s\n", t.name) + root.mu.Unlock() } // Instead of reducing the running count of this test before calling the // tRunner and increasing it afterwards, we rely on tRunner keeping the |
