runtime/pprof: fix flaky TestCPUProfileMultithreaded test

It's too sensitive.

Fixes bug 7095

R=golang-codereviews, iant, minux.ma, rsc
CC=golang-codereviews
https://golang.org/cl/50470043
This commit is contained in:
Keith Randall 2014-01-13 21:18:47 -08:00
parent 6e8b4920c1
commit cefe6ac9a1

View file

@ -142,7 +142,11 @@ func testCPUProfile(t *testing.T, need []string, f func()) {
t.Logf("no CPU profile samples collected") t.Logf("no CPU profile samples collected")
ok = false ok = false
} }
min := total / uintptr(len(have)) / 3 // We'd like to check a reasonable minimum, like
// total / len(have) / smallconstant, but this test is
// pretty flaky (see bug 7095). So we'll just test to
// make sure we got at least one sample.
min := uintptr(1)
for i, name := range need { for i, name := range need {
if have[i] < min { if have[i] < min {
t.Logf("%s has %d samples out of %d, want at least %d, ideally %d", name, have[i], total, min, total/uintptr(len(have))) t.Logf("%s has %d samples out of %d, want at least %d, ideally %d", name, have[i], total, min, total/uintptr(len(have)))