diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-05-08 12:27:54 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-05-08 12:29:00 +0200 |
| commit | 2b98fdbcbcac6e99d12c88857406ef446bcac872 (patch) | |
| tree | 5f2619c16f065e5cf2d3159d7dc974a8eb49791f | |
| parent | fe4122c3bf0b8032bbc19b12cf398adceba6286b (diff) | |
dashboard/app: fix send of replies for patch testing
We used to send replies even if bug has fixing commits.
Was broken in f8368f999a1964df6d39a225cd3f5ab3942dd755
and we did not have a test. Add a test and restore old
behavior.
| -rw-r--r-- | dashboard/app/jobs.go | 23 | ||||
| -rw-r--r-- | dashboard/app/jobs_test.go | 4 |
2 files changed, 16 insertions, 11 deletions
diff --git a/dashboard/app/jobs.go b/dashboard/app/jobs.go index 0933f1436..51d5c8cd4 100644 --- a/dashboard/app/jobs.go +++ b/dashboard/app/jobs.go @@ -581,23 +581,24 @@ func pollCompletedJobs(c context.Context, typ string) ([]*dashapi.BugReport, err if reporting.Config.Type() != typ { continue } - if !notifyAboutUnsuccessfulBisections && job.Type == JobBisectCause && len(job.Commits) != 1 { + if job.Type == JobBisectCause && !notifyAboutUnsuccessfulBisections && len(job.Commits) != 1 { continue } // If BisectFix results in a crash on HEAD, no notification is sent out. if job.Type == JobBisectFix && len(job.Commits) != 1 { continue } - // If the bug is already known to be fixed, invalid or duplicate, do not report the - // bisection results. - bug := new(Bug) - bugKey := keys[i].Parent() - if err := db.Get(c, bugKey, bug); err != nil { - return nil, fmt.Errorf("job %v: failed to get bug: %v", extJobID(keys[i]), err) - } - if len(bug.Commits) != 0 || bug.Status != BugStatusOpen { - jobReported(c, extJobID(keys[i])) - continue + // If the bug is already known to be fixed, invalid or duplicate, do not report the bisection results. + if job.Type == JobBisectCause || job.Type == JobBisectFix { + bug := new(Bug) + bugKey := keys[i].Parent() + if err := db.Get(c, bugKey, bug); err != nil { + return nil, fmt.Errorf("job %v: failed to get bug: %v", extJobID(keys[i]), err) + } + if len(bug.Commits) != 0 || bug.Status != BugStatusOpen { + jobReported(c, extJobID(keys[i])) + continue + } } rep, err := createBugReportForJob(c, job, keys[i], reporting.Config) if err != nil { diff --git a/dashboard/app/jobs_test.go b/dashboard/app/jobs_test.go index 473ca0dc5..06abc8957 100644 --- a/dashboard/app/jobs_test.go +++ b/dashboard/app/jobs_test.go @@ -286,7 +286,11 @@ func TestJobWithoutPatch(t *testing.T) { _, extBugID, err := email.RemoveAddrContext(sender) c.expectOK(err) + // Patch testing should happen for bugs with fix commits too. + c.incomingEmail(sender, "#syz fix: some commit title\n") + c.incomingEmail(sender, "#syz test git://mygit.com/git.git 5e6a2eea\n", EmailOptMessageID(1)) + c.expectNoEmail() pollResp := c.client2.pollJobs(build.Manager) c.expectEQ(pollResp.Type, dashapi.JobTestPatch) testBuild := testBuild(2) |
