mirror of
https://github.com/golang/go
synced 2024-11-12 09:50:21 -07:00
net: fix TestDialFailPDLeak to work when GOMAXPROCS is large
Fixes #6553. R=golang-dev, mikioh.mikioh CC=golang-dev https://golang.org/cl/14526048
This commit is contained in:
parent
139cc96a57
commit
649fc255a9
@ -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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user