aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing.go')
-rw-r--r--src/testing/testing.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/testing/testing.go b/src/testing/testing.go
index bbb10263c3..b9d4f2b5a5 100644
--- a/src/testing/testing.go
+++ b/src/testing/testing.go
@@ -860,7 +860,6 @@ func tRunner(t *T, fn func(t *T)) {
t.Errorf("race detected during execution of test")
}
- t.duration += time.Since(t.start)
// If the test panicked, print any test output before dying.
err := recover()
signal := true
@@ -877,10 +876,20 @@ func tRunner(t *T, fn func(t *T)) {
}
if err != nil {
t.Fail()
- t.report()
+ // Flush the output log up to the root before dying.
+ t.mu.Lock()
+ root := &t.common
+ for ; root.parent != nil; root = root.parent {
+ root.duration += time.Since(root.start)
+ fmt.Fprintf(root.parent.w, "--- FAIL: %s (%s)\n", root.name, fmtDuration(root.duration))
+ root.parent.mu.Lock()
+ io.Copy(root.parent.w, bytes.NewReader(root.output))
+ }
panic(err)
}
+ t.duration += time.Since(t.start)
+
if len(t.sub) > 0 {
// Run parallel subtests.
// Decrease the running count for this test.