diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2025-01-15 17:41:31 +0100 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2025-01-22 13:17:53 +0000 |
| commit | cc143e38041972ad4dbaff9cfbfd416c29d581b5 (patch) | |
| tree | 31e07572a22bebdc20c1fc73a6ef9140c03eb3e5 /syz-cluster/dashboard/handler.go | |
| parent | 6bab9518e47d67b3c9bba00f213aa3e1637063e1 (diff) | |
syz-cluster: add support for findings
Findings are crashes and build/boot/test errors that happened during the
patch series processing.
Diffstat (limited to 'syz-cluster/dashboard/handler.go')
| -rw-r--r-- | syz-cluster/dashboard/handler.go | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/syz-cluster/dashboard/handler.go b/syz-cluster/dashboard/handler.go index d0dfbf6a6..d99c0338f 100644 --- a/syz-cluster/dashboard/handler.go +++ b/syz-cluster/dashboard/handler.go @@ -21,6 +21,7 @@ type DashboardHandler struct { seriesRepo *db.SeriesRepository sessionRepo *db.SessionRepository sessionTestRepo *db.SessionTestRepository + findingRepo *db.FindingRepository blobStorage blob.Storage templates map[string]*template.Template } @@ -43,6 +44,7 @@ func NewHandler(env *app.AppEnvironment) (*DashboardHandler, error) { seriesRepo: db.NewSeriesRepository(env.Spanner), sessionRepo: db.NewSessionRepository(env.Spanner), sessionTestRepo: db.NewSessionTestRepository(env.Spanner), + findingRepo: db.NewFindingRepository(env.Spanner), }, nil } @@ -67,9 +69,13 @@ func (h *DashboardHandler) seriesList(w http.ResponseWriter, r *http.Request) { } func (h *DashboardHandler) seriesInfo(w http.ResponseWriter, r *http.Request) { + type SessionTest struct { + *db.FullSessionTest + Findings []*db.Finding + } type SessionData struct { *db.Session - Tests []*db.FullSessionTest + Tests []SessionTest } type SeriesData struct { *db.Series @@ -97,15 +103,27 @@ func (h *DashboardHandler) seriesInfo(w http.ResponseWriter, r *http.Request) { return } for _, session := range sessions { - tests, err := h.sessionTestRepo.BySession(ctx, session.ID) + rawTests, err := h.sessionTestRepo.BySession(ctx, session.ID) + if err != nil { + http.Error(w, fmt.Sprint(err), http.StatusInternalServerError) + return + } + findings, err := h.findingRepo.ListForSession(ctx, session) if err != nil { http.Error(w, fmt.Sprint(err), http.StatusInternalServerError) return } - data.Sessions = append(data.Sessions, SessionData{ + perName := groupFindings(findings) + sessionData := SessionData{ Session: session, - Tests: tests, - }) + } + for _, test := range rawTests { + sessionData.Tests = append(sessionData.Tests, SessionTest{ + FullSessionTest: test, + Findings: perName[test.TestName], + }) + } + data.Sessions = append(data.Sessions, sessionData) } err = h.templates["series.html"].ExecuteTemplate(w, "base.html", data) @@ -114,6 +132,14 @@ func (h *DashboardHandler) seriesInfo(w http.ResponseWriter, r *http.Request) { } } +func groupFindings(findings []*db.Finding) map[string][]*db.Finding { + ret := map[string][]*db.Finding{} + for _, finding := range findings { + ret[finding.TestName] = append(ret[finding.TestName], finding) + } + return ret +} + // nolint:dupl func (h *DashboardHandler) sessionLog(w http.ResponseWriter, r *http.Request) { ctx := context.Background() |
