From cefe6ac9a1914864c66b8b3044c3e4755d309f80 Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Mon, 13 Jan 2014 21:18:47 -0800 Subject: [PATCH] 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 --- src/pkg/runtime/pprof/pprof_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pkg/runtime/pprof/pprof_test.go b/src/pkg/runtime/pprof/pprof_test.go index d7734eb329..2cae44776c 100644 --- a/src/pkg/runtime/pprof/pprof_test.go +++ b/src/pkg/runtime/pprof/pprof_test.go @@ -142,7 +142,11 @@ func testCPUProfile(t *testing.T, need []string, f func()) { t.Logf("no CPU profile samples collected") 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 { 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))) -- 2.48.1