diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2022-05-20 17:54:33 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2022-05-20 20:06:53 +0200 |
| commit | 7268fa62257981feeebc89e55b5ce45294beff8c (patch) | |
| tree | b408bea6cdbbd10669c990762595657f9893a7ee /dashboard/app/app_test.go | |
| parent | f94bdf2730bcf53b45244e98aedb1a7a7711d49f (diff) | |
dashboard/app: linkify source files in sample reports
Fixes #652
Diffstat (limited to 'dashboard/app/app_test.go')
| -rw-r--r-- | dashboard/app/app_test.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/dashboard/app/app_test.go b/dashboard/app/app_test.go index 9d2ff4dd7..bd512c803 100644 --- a/dashboard/app/app_test.go +++ b/dashboard/app/app_test.go @@ -12,6 +12,7 @@ import ( "testing" "time" + "github.com/google/go-cmp/cmp" "github.com/google/syzkaller/dashboard/dashapi" "github.com/google/syzkaller/pkg/auth" "github.com/google/syzkaller/sys/targets" @@ -687,3 +688,25 @@ func compareBuilds(c *Ctx, dbBuild *Build, build *dashapi.Build) { c.expectEQ(dbBuild.KernelCommit, build.KernelCommit) c.expectEQ(dbBuild.SyzkallerCommit, build.SyzkallerCommit) } + +func TestLinkifyReport(t *testing.T) { + input := ` + tipc_topsrv_stop net/tipc/topsrv.c:694 [inline] + tipc_topsrv_exit_net+0x149/0x340 net/tipc/topsrv.c:715 +kernel BUG at fs/ext4/inode.c:2753! +pkg/sentry/fsimpl/fuse/fusefs.go:278 +0x384 + arch/x86/entry/entry_64.S:298 +` + // nolint: lll + output := ` + tipc_topsrv_stop <a href='https://github.com/google/syzkaller/blob/111222/net/tipc/topsrv.c#L694'>net/tipc/topsrv.c:694</a> [inline] + tipc_topsrv_exit_net+0x149/0x340 <a href='https://github.com/google/syzkaller/blob/111222/net/tipc/topsrv.c#L715'>net/tipc/topsrv.c:715</a> +kernel BUG at <a href='https://github.com/google/syzkaller/blob/111222/fs/ext4/inode.c#L2753'>fs/ext4/inode.c:2753</a>! +<a href='https://github.com/google/syzkaller/blob/111222/pkg/sentry/fsimpl/fuse/fusefs.go#L278'>pkg/sentry/fsimpl/fuse/fusefs.go:278</a> +0x384 + <a href='https://github.com/google/syzkaller/blob/111222/arch/x86/entry/entry_64.S#L298'>arch/x86/entry/entry_64.S:298</a> +` + got := linkifyReport([]byte(input), "https://github.com/google/syzkaller", "111222") + if diff := cmp.Diff(output, string(got)); diff != "" { + t.Fatal(diff) + } +} |
