From: Ian Lance Taylor Date: Wed, 9 Oct 2013 20:52:29 +0000 (-0700) Subject: net: fix TestDialFailPDLeak to work when GOMAXPROCS is large X-Git-Tag: go1.2rc2~42 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=649fc255a9c7b6e05249dbde1176aecd17135cc3;p=gostls13.git net: fix TestDialFailPDLeak to work when GOMAXPROCS is large Fixes #6553. R=golang-dev, mikioh.mikioh CC=golang-dev https://golang.org/cl/14526048 --- 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() }