From 6f03c356200becfa347b8abade66ac74f52c10c9 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 25 Dec 2017 12:07:06 +0100 Subject: dashboard/app: extract fixing tags from commits Support the new scheme of associating fixing commits with bugs. Now we provide a tag along the lines of: Reported-by: The tag is supposed to be added to the commit. Then we parse commit logs and extract these tags. The final part on the dashboard is not ready yet, but syz-ci should already parse and send the tags. --- pkg/git/git_test.go | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'pkg/git/git_test.go') diff --git a/pkg/git/git_test.go b/pkg/git/git_test.go index 3cc1300dd..8e23e84b2 100644 --- a/pkg/git/git_test.go +++ b/pkg/git/git_test.go @@ -4,6 +4,8 @@ package git import ( + "reflect" + "strings" "testing" ) @@ -72,3 +74,49 @@ func TestCheckBranch(t *testing.T) { } } } + +func TestExtractFixTags(t *testing.T) { + commits, err := extractFixTags(strings.NewReader(extractFixTagsInput), extractFixTagsEmail) + if err != nil { + t.Fatal(err) + } + if !reflect.DeepEqual(commits, extractFixTagsOutput) { + t.Fatalf("got : %+v\twant: %+v", commits, extractFixTagsOutput) + } +} + +const extractFixTagsEmail = "\"syzbot\" " + +var extractFixTagsOutput = []FixCommit{ + {"8e4090902540da8c6e8f", "dashboard/app: bump max repros per bug to 10"}, + {"8e4090902540da8c6e8f", "executor: remove dead code"}, + {"a640a0fc325c29c3efcb", "executor: remove dead code"}, + {"8e4090902540da8c6e8fa640a0fc325c29c3efcb", "pkg/csource: fix string escaping bug"}, +} + +var extractFixTagsInput = ` +commit 73aba437a774237b1130837b856f3b40b3ec3bf0 (HEAD -> master, origin/master) +Author: me +Date: Fri Dec 22 19:59:56 2017 +0100 + + dashboard/app: bump max repros per bug to 10 + + Reported-by: syzbot+8e4090902540da8c6e8f@my.mail.com + +commit 26cd53f078db858a6ccca338e13e7f4d1d291c22 +Author: me +Date: Fri Dec 22 13:42:27 2017 +0100 + + executor: remove dead code + + Reported-by: syzbot+8e4090902540da8c6e8f@my.mail.com + Reported-by: syzbot + +commit 7b62abdb0abadbaf7b3f3a23ab4d78485fbf9059 +Author: Dmitry Vyukov +Date: Fri Dec 22 11:59:09 2017 +0100 + + pkg/csource: fix string escaping bug + + Reported-and-tested-by: syzbot+8e4090902540da8c6e8fa640a0fc325c29c3efcb@my.mail.com +` -- cgit mrf-deployment