Skip to content

Commit 9c2037f

Browse files
committed
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 <[email protected]> Run-TryBot: Michael Matloob <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Michael Matloob <[email protected]>
1 parent 60a9bf9 commit 9c2037f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/runtime/pprof/internal/protopprof/protopprof_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ func TestTranslateCPUProfileWithSamples(t *testing.T) {
162162
t.Fatalf("Cannot parse /proc/self/maps")
163163
}
164164
if len(mprof.Mapping) < 2 {
165-
t.Fatalf("Less than two mappings")
165+
// It is possible for a binary to only have 1 executable
166+
// region of memory.
167+
t.Skipf("need 2 or more mappings, got %v", len(mprof.Mapping))
166168
}
167169
address1 := mprof.Mapping[0].Start
168170
address2 := mprof.Mapping[1].Start

0 commit comments

Comments
 (0)