MCPcopy Create free account
hub / github.com/google/pprof / TestUnsourceMappings

Function TestUnsourceMappings

internal/driver/fetch_test.go:131–159  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

129}
130
131func TestUnsourceMappings(t *testing.T) {
132 for _, tc := range []struct {
133 os, file, buildID, want string
134 }{
135 {"any", "/usr/bin/binary", "buildId", "/usr/bin/binary"},
136 {"any", "http://example.com", "", ""},
137 {"windows", `C:\example.exe`, "", `C:\example.exe`},
138 {"windows", `c:/example.exe`, "", `c:/example.exe`},
139 } {
140 t.Run(tc.file+"-"+tc.os, func(t *testing.T) {
141 if tc.os != "any" && tc.os != runtime.GOOS {
142 t.Skipf("%s only test", tc.os)
143 }
144
145 p := &profile.Profile{
146 Mapping: []*profile.Mapping{
147 {
148 File: tc.file,
149 BuildID: tc.buildID,
150 },
151 },
152 }
153 unsourceMappings(p)
154 if got := p.Mapping[0].File; got != tc.want {
155 t.Errorf("%s:%s, want %s, got %s", tc.file, tc.buildID, tc.want, got)
156 }
157 })
158 }
159}
160
161type testObj struct {
162 home string

Callers

nothing calls this directly

Calls 1

unsourceMappingsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…