(t *testing.T)
| 27 | var allPlatforms goarchList = nil |
| 28 | |
| 29 | func TestAugment(t *testing.T) { |
| 30 | t.Parallel() |
| 31 | |
| 32 | gm := map[string]string{"/root": "main"} |
| 33 | newCallSrc := func(f string, a Args, s string, l int) Call { |
| 34 | c := newCall(f, a, s, l) |
| 35 | // Simulate findRoots(). |
| 36 | if !c.updateLocations(goroot, goroot, gm, gopaths) { |
| 37 | t.Fatalf("c.updateLocations(%v, %v, %v, %v) failed on %s", goroot, goroot, gm, gopaths, s) |
| 38 | } |
| 39 | return c |
| 40 | } |
| 41 | |
| 42 | // For test case "negative int32". |
| 43 | negInt := uint64(4294967173) |
| 44 | negPtr := false |
| 45 | if bits.UintSize == 64 { |
| 46 | negInt = 828928688005 |
| 47 | negPtr = true |
| 48 | } |
| 49 | |
| 50 | type testCase struct { |
| 51 | name string |
| 52 | input string |
| 53 | // Due to inlining, the stack trace may (it depends on tool chain version) |
| 54 | // not contain much information about the arguments and shows as elided. |
| 55 | // Non-pointer call may show an elided argument, while there was no |
| 56 | // argument listed before. |
| 57 | mayBeInlined bool |
| 58 | // archBlock lists the CPU architectures to skip this test case on. |
| 59 | // |
| 60 | // Many test are hard to parse in 32 bits. Eventually we should fix these |
| 61 | // but I don't have time for this. |
| 62 | // |
| 63 | // The list is based on https://github.com/maruel/panicparse/issues/80. |
| 64 | // I was able to locally reproduce amd64 and 386 but not the rest. |
| 65 | archBlock goarchList |
| 66 | want Stack |
| 67 | } |
| 68 | data := []testCase{ |
| 69 | { |
| 70 | "local function doesn't interfere", |
| 71 | `func main() { |
| 72 | f("yo") |
| 73 | } |
| 74 | func f(s string) { |
| 75 | a := func(i int) int { |
| 76 | return 1 + i |
| 77 | } |
| 78 | _ = a(3) |
| 79 | panic("ooh") |
| 80 | }`, |
| 81 | // The function became inlinable in go 1.17. |
| 82 | true, |
| 83 | goarchList{"arm", "arm64", "ppc64le", "riscv64"}, |
| 84 | Stack{ |
| 85 | Calls: []Call{ |
| 86 | newCallSrc( |
nothing calls this directly
no test coverage detected
searching dependent graphs…