aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2019-03-19 16:37:21 +0100
committerDmitry Vyukov <dvyukov@google.com>2019-03-19 16:37:21 +0100
commit3f1c29d938900aa03cb6233aa857049a9841b7c2 (patch)
tree45632c050cbf6047dc56c3996cf8aa1cada35991
parent28c04d39e052ee2960eebc16a3f7fba88920cd52 (diff)
dashboard/app: report bisection results to external reporting
Update #501
-rw-r--r--dashboard/app/bisect_test.go42
-rw-r--r--dashboard/app/reporting_external.go17
-rw-r--r--dashboard/app/util_test.go1
-rw-r--r--dashboard/dashapi/dashapi.go3
4 files changed, 62 insertions, 1 deletions
diff --git a/dashboard/app/bisect_test.go b/dashboard/app/bisect_test.go
index f944cd57b..0f1002acd 100644
--- a/dashboard/app/bisect_test.go
+++ b/dashboard/app/bisect_test.go
@@ -500,3 +500,45 @@ https://goo.gl/tpsmEJ#testing-patches`,
bisectLogLink, bisectCrashReportLink, bisectCrashLogLink))
}
}
+
+func TestBisectCauseExternal(t *testing.T) {
+ c := NewCtx(t)
+ defer c.Close()
+
+ build := testBuild(1)
+ c.client.UploadBuild(build)
+ crash := testCrashWithRepro(build, 1)
+ c.client.ReportCrash(crash)
+ rep := c.client.pollBug()
+
+ pollResp, err := c.client.JobPoll([]string{build.Manager})
+ c.expectOK(err)
+ jobID := pollResp.ID
+ done := &dashapi.JobDoneReq{
+ ID: jobID,
+ Build: *build,
+ Log: []byte("bisect log"),
+ Commits: []dashapi.Commit{
+ {
+ Hash: "111111111111111111111111",
+ Title: "kernel: break build",
+ Author: "hacker@kernel.org",
+ AuthorName: "Hacker Kernelov",
+ CC: []string{"reviewer1@kernel.org", "reviewer2@kernel.org"},
+ Date: time.Date(2000, 2, 9, 4, 5, 6, 7, time.UTC),
+ },
+ },
+ }
+ done.Build.ID = jobID
+ c.expectOK(c.client2.JobDone(done))
+
+ resp, _ := c.client.ReportingPollBugs("test")
+ c.expectEQ(len(resp.Reports), 1)
+ // Still reported because we did not ack.
+ bisect := c.client.pollBug()
+ // pollBug acks, must not be reported after that.
+ c.client.pollBugs(0)
+
+ c.expectEQ(bisect.Type, dashapi.ReportBisectCause)
+ c.expectEQ(bisect.Title, rep.Title)
+}
diff --git a/dashboard/app/reporting_external.go b/dashboard/app/reporting_external.go
index 4dd85e87f..846f1f3c9 100644
--- a/dashboard/app/reporting_external.go
+++ b/dashboard/app/reporting_external.go
@@ -34,6 +34,11 @@ func apiReportingPollBugs(c context.Context, r *http.Request, payload []byte) (i
resp := &dashapi.PollBugsResponse{
Reports: reports,
}
+ jobs, err := pollCompletedJobs(c, req.Type)
+ if err != nil {
+ log.Errorf(c, "failed to poll jobs: %v", err)
+ }
+ resp.Reports = append(resp.Reports, jobs...)
return resp, nil
}
@@ -70,6 +75,18 @@ func apiReportingUpdate(c context.Context, r *http.Request, payload []byte) (int
if err := json.Unmarshal(payload, req); err != nil {
return nil, fmt.Errorf("failed to unmarshal request: %v", err)
}
+ if req.JobID != "" {
+ resp := &dashapi.BugUpdateReply{
+ OK: true,
+ Error: false,
+ }
+ if err := jobReported(c, req.JobID); err != nil {
+ log.Errorf(c, "failed to mark job reported: %v", err)
+ resp.Text = err.Error()
+ resp.Error = true
+ }
+ return resp, nil
+ }
ok, reason, err := incomingCommand(c, req)
return &dashapi.BugUpdateReply{
OK: ok,
diff --git a/dashboard/app/util_test.go b/dashboard/app/util_test.go
index d61fa0caf..40ab3f1e1 100644
--- a/dashboard/app/util_test.go
+++ b/dashboard/app/util_test.go
@@ -302,6 +302,7 @@ func (client *apiClient) pollBugs(expect int) []*dashapi.BugReport {
}
reply, _ := client.ReportingUpdate(&dashapi.BugUpdate{
ID: rep.ID,
+ JobID: rep.JobID,
Status: dashapi.BugStatusOpen,
ReproLevel: reproLevel,
CrashID: rep.CrashID,
diff --git a/dashboard/dashapi/dashapi.go b/dashboard/dashapi/dashapi.go
index 006ed1ce7..24f2a87a1 100644
--- a/dashboard/dashapi/dashapi.go
+++ b/dashboard/dashapi/dashapi.go
@@ -332,7 +332,8 @@ type BisectResult struct {
}
type BugUpdate struct {
- ID string
+ ID string // copied from BugReport
+ JobID string // copied from BugReport
ExtID string
Link string
Status BugStatus