diff options
author | Ian Lance Taylor <iant@golang.org> | 2013-10-09 13:52:29 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2013-10-09 13:52:29 -0700 |
commit | 649fc255a9c7b6e05249dbde1176aecd17135cc3 (patch) | |
tree | 31e709a97f21589cdb0d53346b2527b111e575d5 | |
parent | 139cc96a5718f59867e1a4295a29c46bc38a9a29 (diff) | |
download | go-649fc255a9c7b6e05249dbde1176aecd17135cc3.tar.gz go-649fc255a9c7b6e05249dbde1176aecd17135cc3.zip |
net: fix TestDialFailPDLeak to work when GOMAXPROCS is large
Fixes #6553.
R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/14526048
-rw-r--r-- | src/pkg/net/dial_test.go | 5 |
1 files 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() } |