aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/stack_test.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2017-06-08 13:48:41 -0400
committerAustin Clements <austin@google.com>2017-06-08 18:21:37 +0000
commit84890c72fc2668074549b4e47b9f21e6fb955cff (patch)
tree2b0442c3f1d9947385c784dff16627d7df10862d /src/runtime/stack_test.go
parent829adf5047bee5a7cd746e9d6d00d09eb7ac4adb (diff)
downloadgo-84890c72fc2668074549b4e47b9f21e6fb955cff.tar.xz
runtime: more diagnostics for TestStackGrowth
This adds diagnostics so we can tell if the finalizer has started, in addition to whether or not it has finished. Updates #19381. Change-Id: Icb7b1b0380c9ad1128b17074828945511a6cca5d Reviewed-on: https://go-review.googlesource.com/45138 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/stack_test.go')
-rw-r--r--src/runtime/stack_test.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/runtime/stack_test.go b/src/runtime/stack_test.go
index 7a758d1897..965c4e6838 100644
--- a/src/runtime/stack_test.go
+++ b/src/runtime/stack_test.go
@@ -8,6 +8,7 @@ import (
. "runtime"
"strings"
"sync"
+ "sync/atomic"
"testing"
"time"
)
@@ -97,9 +98,11 @@ func TestStackGrowth(t *testing.T) {
go func() {
defer wg.Done()
done := make(chan bool)
+ var started uint32
go func() {
s := new(string)
SetFinalizer(s, func(ss *string) {
+ atomic.StoreUint32(&started, 1)
growStack()
done <- true
})
@@ -111,6 +114,9 @@ func TestStackGrowth(t *testing.T) {
select {
case <-done:
case <-time.After(20 * time.Second):
+ if atomic.LoadUint32(&started) == 0 {
+ t.Log("finalizer did not start")
+ }
t.Error("finalizer did not run")
return
}