From e6b023473e03762056c406a655c9fb30141752e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Oudompheng?= Date: Thu, 19 Dec 2013 21:37:44 +0100 Subject: [PATCH] runtime: reduce delays in finalizer test. The runtime tests are executed 4 times in all.bash and there is currently a 5-second delay each time. R=golang-dev, minux.ma, khr, bradfitz CC=golang-dev https://golang.org/cl/42450043 --- src/pkg/runtime/mfinal_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pkg/runtime/mfinal_test.go b/src/pkg/runtime/mfinal_test.go index 4a34cd61bd..ffcffbd4be 100644 --- a/src/pkg/runtime/mfinal_test.go +++ b/src/pkg/runtime/mfinal_test.go @@ -46,13 +46,15 @@ func TestFinalizerType(t *testing.T) { } for _, tt := range finalizerTests { + done := make(chan bool, 1) go func() { v := new(int) *v = 97531 runtime.SetFinalizer(tt.convert(v), tt.finalizer) v = nil + done <- true }() - time.Sleep(1 * time.Second) + <-done runtime.GC() select { case <-ch: @@ -73,6 +75,7 @@ func TestFinalizerInterfaceBig(t *testing.T) { t.Skipf("Skipping on non-amd64 machine") } ch := make(chan bool) + done := make(chan bool, 1) go func() { v := &bigValue{0xDEADBEEFDEADBEEF, true, "It matters not how strait the gate"} old := *v @@ -87,8 +90,9 @@ func TestFinalizerInterfaceBig(t *testing.T) { close(ch) }) v = nil + done <- true }() - time.Sleep(1 * time.Second) + <-done runtime.GC() select { case <-ch: