From: Michael Munday Date: Tue, 8 Nov 2016 22:11:18 +0000 (-0500) Subject: runtime/pprof/internal/protopprof: skip TestTranslateCPUProfileWithSamples if < 2... X-Git-Tag: go1.8beta1~246 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=9c2037fbcf1a732f55e29062f3d30ddd21ca36d3;p=gostls13.git runtime/pprof/internal/protopprof: skip TestTranslateCPUProfileWithSamples if < 2 mappings A Go binary may only have 1 executable memory region if it has been linked using internal linking. This change means that the test will be skipped if this is the case, rather than fail. Fixes #17852. Change-Id: I59459a0f90ae8963aeb9908e5cb9fb64d7d0e0f4 Reviewed-on: https://go-review.googlesource.com/32920 Run-TryBot: Michael Munday Run-TryBot: Michael Matloob TryBot-Result: Gobot Gobot Reviewed-by: Michael Matloob --- diff --git a/src/runtime/pprof/internal/protopprof/protopprof_test.go b/src/runtime/pprof/internal/protopprof/protopprof_test.go index 2884b1005a..beecefe04c 100644 --- a/src/runtime/pprof/internal/protopprof/protopprof_test.go +++ b/src/runtime/pprof/internal/protopprof/protopprof_test.go @@ -162,7 +162,9 @@ func TestTranslateCPUProfileWithSamples(t *testing.T) { t.Fatalf("Cannot parse /proc/self/maps") } if len(mprof.Mapping) < 2 { - t.Fatalf("Less than two mappings") + // It is possible for a binary to only have 1 executable + // region of memory. + t.Skipf("need 2 or more mappings, got %v", len(mprof.Mapping)) } address1 := mprof.Mapping[0].Start address2 := mprof.Mapping[1].Start