]> Cypherpunks repositories - gostls13.git/commitdiff
runtime/pprof: fix profile parser in test
authorRuss Cox <rsc@golang.org>
Mon, 23 Sep 2013 20:05:36 +0000 (16:05 -0400)
committerRuss Cox <rsc@golang.org>
Mon, 23 Sep 2013 20:05:36 +0000 (16:05 -0400)
Fixes #6417.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13843043

src/pkg/runtime/pprof/pprof_test.go

index 419178415a773d25e08b447da20e9b2538d83968..d4f9f633bcc5ddaa2e50f8db64bbcde49c97aef6 100644 (file)
@@ -58,7 +58,8 @@ func parseProfile(t *testing.T, bytes []byte, f func(uintptr, []uintptr)) {
        val := *(*[]uintptr)(unsafe.Pointer(&bytes))
        val = val[:l]
 
-       if l < 13 {
+       // 5 for the header, 2 for the per-sample header on at least one sample, 3 for the trailer.
+       if l < 5+2+3 {
                t.Logf("profile too short: %#x", val)
                if badOS[runtime.GOOS] {
                        t.Skipf("ignoring failure on %s; see golang.org/issue/6047", runtime.GOOS)