Commit 649fc255 authored by Ian Lance Taylor's avatar Ian Lance Taylor

net: fix TestDialFailPDLeak to work when GOMAXPROCS is large

Fixes #6553.

R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/14526048
parent 139cc96a
...@@ -436,7 +436,8 @@ func TestDialFailPDLeak(t *testing.T) { ...@@ -436,7 +436,8 @@ func TestDialFailPDLeak(t *testing.T) {
t.Skipf("skipping test on %q/%q", runtime.GOOS, runtime.GOARCH) 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. // 500 is enough to turn over the chunk of pollcache.
// See allocPollDesc in runtime/netpoll.goc. // See allocPollDesc in runtime/netpoll.goc.
const count = 500 const count = 500
...@@ -471,7 +472,7 @@ func TestDialFailPDLeak(t *testing.T) { ...@@ -471,7 +472,7 @@ func TestDialFailPDLeak(t *testing.T) {
failcount++ failcount++
} }
// there are always some allocations on the first loop // 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.Error("detected possible memory leak in runtime")
t.FailNow() t.FailNow()
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment