dwarf/line: fix TestDebugLinePrologueParser test for Go 1.14 (#1891)

Go 1.14 has more fake file names, apparently (also go fmt).
This commit is contained in:
Alessandro Arzilli 2020-02-27 05:38:31 +01:00 committed by GitHub
parent 7560c33819
commit 14733084a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -114,10 +114,10 @@ func testDebugLinePrologueParser(p string, t *testing.T) {
} }
for _, ln := range dbl.Lookup { for _, ln := range dbl.Lookup {
if ln.Path == "<autogenerated>" { if ln.Path == "<autogenerated>" || strings.HasPrefix(ln.Path, "<missing>_") || ln.Path == "_gomod_.go" {
continue continue
} }
if _, err := os.Stat(ln.Path); err != nil { if _, err := os.Stat(ln.Path); err != nil {
t.Fatalf("Invalid input path %s: %s\n", ln.Path, err) t.Fatalf("Invalid input path %s: %s\n", ln.Path, err)
} }
} }
@ -299,7 +299,7 @@ func BenchmarkPCToLine(b *testing.B) {
} }
} }
func TestDebugLineC(t * testing.T) { func TestDebugLineC(t *testing.T) {
p, err := filepath.Abs("../../../_fixtures/debug_line_c_data") p, err := filepath.Abs("../../../_fixtures/debug_line_c_data")
if err != nil { if err != nil {
t.Fatal("Could not find test data", p, err) t.Fatal("Could not find test data", p, err)
@ -316,9 +316,9 @@ func TestDebugLineC(t * testing.T) {
t.Fatal("Parser result is empty") t.Fatal("Parser result is empty")
} }
file := []string{"main.c", "/mnt/c/develop/delve/_fixtures/main.c" ,"/usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h", file := []string{"main.c", "/mnt/c/develop/delve/_fixtures/main.c", "/usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h",
"/usr/include/x86_64-linux-gnu/bits/types.h" ,"/usr/include/x86_64-linux-gnu/bits/libio.h", "/usr/include/stdio.h", "/usr/include/x86_64-linux-gnu/bits/types.h", "/usr/include/x86_64-linux-gnu/bits/libio.h", "/usr/include/stdio.h",
"/usr/include/x86_64-linux-gnu/bits/sys_errlist.h"} "/usr/include/x86_64-linux-gnu/bits/sys_errlist.h"}
for _, ln := range parsed { for _, ln := range parsed {
if len(ln.FileNames) == 0 { if len(ln.FileNames) == 0 {