diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2019-03-18 09:51:33 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2019-03-18 09:51:33 +0100 |
| commit | 08db11409e951dec09f7320771d95167e05b06d3 (patch) | |
| tree | a1506ec2162767c29158a9b8ecc5fa015258f0dc | |
| parent | 4656becafbd6c9a181ee8516f6b2a26103668273 (diff) | |
dashboard/app: make email tests more interesting
1. Mail bugs for second and third reportings to different emails
so that it's possible to distinguish where they are actually mailed.
2. Add bisection test where we skip bug in the second reporting.
Bisection results should go straigth to third as well.
| -rw-r--r-- | dashboard/app/app_test.go | 13 | ||||
| -rw-r--r-- | dashboard/app/bisect_test.go | 10 | ||||
| -rw-r--r-- | dashboard/app/email_test.go | 9 | ||||
| -rw-r--r-- | dashboard/app/notifications_test.go | 2 | ||||
| -rw-r--r-- | dashboard/app/util_test.go | 2 |
5 files changed, 27 insertions, 9 deletions
diff --git a/dashboard/app/app_test.go b/dashboard/app/app_test.go index 5e9048c36..7351b4040 100644 --- a/dashboard/app/app_test.go +++ b/dashboard/app/app_test.go @@ -103,6 +103,7 @@ var testConfig = &GlobalConfig{ { Name: "reporting2", DailyLimit: 3, + Filter: skipWithRepro2, Config: &EmailConfig{ Email: "bugs@syzkaller.com", DefaultMaintainers: []string{"default@maintainers.com"}, @@ -113,8 +114,8 @@ var testConfig = &GlobalConfig{ Name: "reporting3", DailyLimit: 3, Config: &EmailConfig{ - Email: "bugs@syzkaller.com", - DefaultMaintainers: []string{"default@maintainers.com"}, + Email: "bugs2@syzkaller.com", + DefaultMaintainers: []string{"default2@maintainers.com"}, MailMaintainers: true, }, }, @@ -219,6 +220,14 @@ func skipWithRepro(bug *Bug) FilterResult { return FilterReport } +func skipWithRepro2(bug *Bug) FilterResult { + if strings.HasPrefix(bug.Title, "skip reporting2 with repro") && + bug.ReproLevel != dashapi.ReproLevelNone { + return FilterSkip + } + return FilterReport +} + type TestConfig struct { Index int } diff --git a/dashboard/app/bisect_test.go b/dashboard/app/bisect_test.go index 2d6656287..a99c4e8b7 100644 --- a/dashboard/app/bisect_test.go +++ b/dashboard/app/bisect_test.go @@ -42,6 +42,7 @@ func TestBisectCause(t *testing.T) { // This does not have C repro, so will be bisected after the previous ones. c.advanceTime(time.Hour) crash4 := testCrashWithRepro(build, 4) + crash4.Title = "skip reporting2 with repro" crash4.ReproC = nil c.client2.ReportCrash(crash4) msg4 := c.client2.pollEmailBug() @@ -220,8 +221,13 @@ https://goo.gl/tpsmEJ#testing-patches`, } // Crash 4 is bisected in reporting with MailMaintainers. + // It also skipped second reporting beacuse of the title. c.incomingEmail(msg4.Sender, "#syz upstream") msg4 = c.pollEmailBug() + c.expectEQ(msg4.To, []string{ + "bugs2@syzkaller.com", + "default2@maintainers.com", + }) pollResp, _ = c.client2.JobPoll([]string{build.Manager}) // Bisection succeeded. @@ -258,8 +264,8 @@ https://goo.gl/tpsmEJ#testing-patches`, c.expectEQ(msg.Subject, crash4.Title) c.expectEQ(msg.To, []string{ "author@kernel.org", - "bugs@syzkaller.com", - "default@maintainers.com", + "bugs2@syzkaller.com", + "default2@maintainers.com", "reviewer1@kernel.org", "reviewer2@kernel.org", }) diff --git a/dashboard/app/email_test.go b/dashboard/app/email_test.go index b5bfebee9..8065477e1 100644 --- a/dashboard/app/email_test.go +++ b/dashboard/app/email_test.go @@ -133,7 +133,8 @@ For more options, visit https://groups.google.com/d/optout. kernelConfigLink := externalLink(c.ctx, textKernelConfig, dbBuild.KernelConfig) c.expectEQ(sender, fromAddr(c.ctx)) to := []string{ - "bugs@syzkaller.com", + "bugs2@syzkaller.com", + "bugs@syzkaller.com", // This is from incomingEmail. "default@sender.com", // This is from incomingEmail. "foo@bar.com", config.Namespaces["test2"].Reporting[0].Config.(*EmailConfig).Email, @@ -446,7 +447,6 @@ func TestEmailUndup(t *testing.T) { } func TestEmailCrossReportingDup(t *testing.T) { - // TODO: c := NewCtx(t) defer c.Close() @@ -491,7 +491,10 @@ func TestEmailCrossReportingDup(t *testing.T) { c.incomingEmail(bugSender, "#syz dup: "+crash2.Title) if test.result { - c.expectEQ(len(c.emailSink), 0) + if len(c.emailSink) != 0 { + msg := <-c.emailSink + t.Fatalf("unexpected reply: %s\n%s\n", msg.Subject, msg.Body) + } } else { c.expectEQ(len(c.emailSink), 1) msg := <-c.emailSink diff --git a/dashboard/app/notifications_test.go b/dashboard/app/notifications_test.go index 2223a2c33..d59465e57 100644 --- a/dashboard/app/notifications_test.go +++ b/dashboard/app/notifications_test.go @@ -158,7 +158,7 @@ func TestEmailNotifObsoleted(t *testing.T) { if !strings.Contains(notif.Body, "Auto-closing this bug as obsolete") { t.Fatalf("bad notification text: %q", notif.Body) } - c.expectEQ(notif.To, []string{"bugs@syzkaller.com"}) + c.expectEQ(notif.To, []string{"bugs2@syzkaller.com"}) } func TestEmailNotifNotObsoleted(t *testing.T) { diff --git a/dashboard/app/util_test.go b/dashboard/app/util_test.go index c909524c5..d61fa0caf 100644 --- a/dashboard/app/util_test.go +++ b/dashboard/app/util_test.go @@ -358,7 +358,7 @@ type ( func (c *Ctx) incomingEmail(to, body string, opts ...interface{}) { id := 0 from := "default@sender.com" - cc := []string{"test@syzkaller.com", "bugs@syzkaller.com"} + cc := []string{"test@syzkaller.com", "bugs@syzkaller.com", "bugs2@syzkaller.com"} for _, o := range opts { switch opt := o.(type) { case EmailOptMessageID: |
