]> Cypherpunks repositories - gostls13.git/commitdiff
runtime/pprof: fix flaky TestCPUProfileMultithreaded test
authorKeith Randall <khr@golang.org>
Tue, 14 Jan 2014 05:18:47 +0000 (21:18 -0800)
committerKeith Randall <khr@golang.org>
Tue, 14 Jan 2014 05:18:47 +0000 (21:18 -0800)
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

index d7734eb3290d1d1a8791b9ff550438422c26e89e..2cae44776c9adc8604f0f2967270042f90ed18d3 100644 (file)
@@ -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)))