(t *testing.T)
| 150 | } |
| 151 | |
| 152 | func TestAggregateAggressive(t *testing.T) { |
| 153 | t.Parallel() |
| 154 | // 3 goroutines with similar signatures. |
| 155 | data := []string{ |
| 156 | "panic: runtime error: index out of range", |
| 157 | "", |
| 158 | "goroutine 6 [chan receive, 10 minutes]:", |
| 159 | "main.func·001({0x11000000, 2}, 3)", |
| 160 | "\t/gopath/src/github.com/maruel/panicparse/stack/stack.go:72 +0x49", |
| 161 | "", |
| 162 | "goroutine 7 [chan receive, 50 minutes]:", |
| 163 | "main.func·001({0x21000000, 2}, 3)", |
| 164 | "\t/gopath/src/github.com/maruel/panicparse/stack/stack.go:72 +0x49", |
| 165 | "", |
| 166 | "goroutine 8 [chan receive, 100 minutes]:", |
| 167 | "main.func·001({0x31000000, 2}, 3)", |
| 168 | "\t/gopath/src/github.com/maruel/panicparse/stack/stack.go:72 +0x49", |
| 169 | "", |
| 170 | } |
| 171 | s, suffix, err := ScanSnapshot(bytes.NewBufferString(strings.Join(data, "\n")), io.Discard, defaultOpts()) |
| 172 | if err != io.EOF { |
| 173 | t.Fatal(err) |
| 174 | } |
| 175 | if s == nil { |
| 176 | t.Fatal("expected snapshot") |
| 177 | } |
| 178 | want := []*Bucket{ |
| 179 | { |
| 180 | Signature: Signature{ |
| 181 | State: "chan receive", |
| 182 | SleepMin: 10, |
| 183 | SleepMax: 100, |
| 184 | Stack: Stack{ |
| 185 | Calls: []Call{ |
| 186 | newCall( |
| 187 | "main.func·001", |
| 188 | Args{Values: []Arg{ |
| 189 | {IsAggregate: true, Fields: Args{ |
| 190 | Values: []Arg{{Value: 0x11000000, Name: "*", IsPtr: true}, {Value: 2}}, |
| 191 | }}, |
| 192 | {Value: 3}, |
| 193 | }}, |
| 194 | "/gopath/src/github.com/maruel/panicparse/stack/stack.go", |
| 195 | 72), |
| 196 | }, |
| 197 | }, |
| 198 | }, |
| 199 | IDs: []int{6, 7, 8}, |
| 200 | First: true, |
| 201 | }, |
| 202 | } |
| 203 | compareBuckets(t, want, s.Aggregate(AnyPointer).Buckets) |
| 204 | compareString(t, "", string(suffix)) |
| 205 | } |
| 206 | |
| 207 | func TestAggregateDeadlockPanic(t *testing.T) { |
| 208 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…