From 649fc255a9c7b6e05249dbde1176aecd17135cc3 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 9 Oct 2013 13:52:29 -0700 Subject: [PATCH] net: fix TestDialFailPDLeak to work when GOMAXPROCS is large Fixes #6553. R=golang-dev, mikioh.mikioh CC=golang-dev https://golang.org/cl/14526048 --- src/pkg/net/dial_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pkg/net/dial_test.go b/src/pkg/net/dial_test.go index c7296b7a9c..f1d813f412 100644 --- a/src/pkg/net/dial_test.go +++ b/src/pkg/net/dial_test.go @@ -436,7 +436,8 @@ func TestDialFailPDLeak(t *testing.T) { t.Skipf("skipping test on %q/%q", runtime.GOOS, runtime.GOARCH) } - const loops = 10 + maxprocs := runtime.GOMAXPROCS(0) + loops := 10 + maxprocs // 500 is enough to turn over the chunk of pollcache. // See allocPollDesc in runtime/netpoll.goc. const count = 500 @@ -471,7 +472,7 @@ func TestDialFailPDLeak(t *testing.T) { failcount++ } // there are always some allocations on the first loop - if failcount > 3 { + if failcount > maxprocs+2 { t.Error("detected possible memory leak in runtime") t.FailNow() } -- 2.48.1