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

Function TestCollectMappingSources

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

Source from the content-addressed store, hash-verified

102}
103
104func TestCollectMappingSources(t *testing.T) {
105 const startAddress uint64 = 0x40000
106 const url = "http://example.com"
107 for _, tc := range []struct {
108 file, buildID string
109 want plugin.MappingSources
110 }{
111 {"/usr/bin/binary", "buildId", mappingSources("buildId", url, startAddress)},
112 {"/usr/bin/binary", "", mappingSources("/usr/bin/binary", url, startAddress)},
113 {"", "", mappingSources(url, url, startAddress)},
114 } {
115 p := &profile.Profile{
116 Mapping: []*profile.Mapping{
117 {
118 File: tc.file,
119 BuildID: tc.buildID,
120 Start: startAddress,
121 },
122 },
123 }
124 got := collectMappingSources(p, url)
125 if !reflect.DeepEqual(got, tc.want) {
126 t.Errorf("%s:%s, want %v, got %v", tc.file, tc.buildID, tc.want, got)
127 }
128 }
129}
130
131func TestUnsourceMappings(t *testing.T) {
132 for _, tc := range []struct {

Callers

nothing calls this directly

Calls 2

mappingSourcesFunction · 0.85
collectMappingSourcesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…