diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2021-12-03 19:12:47 +0000 |
|---|---|---|
| committer | Aleksandr Nogikh <wp32pw@gmail.com> | 2021-12-06 14:29:36 +0100 |
| commit | 40ec852a0b6073c78a43148b36ba9ef67954e18b (patch) | |
| tree | 79aa759dda87fe57b8b794f26271e897039311de /tools | |
| parent | 19bd435f7d6275cbfbb01c354c45ab0df0df395c (diff) | |
tools/syz-testbed: add a bug count table
This table does not just collect YES/NO, but also shows the number of
test runs in which syz-manager has discovered the given bug.
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/syz-testbed/html.go | 15 | ||||
| -rw-r--r-- | tools/syz-testbed/stats.go | 33 |
2 files changed, 42 insertions, 6 deletions
diff --git a/tools/syz-testbed/html.go b/tools/syz-testbed/html.go index fd77b4acb..beebc8c24 100644 --- a/tools/syz-testbed/html.go +++ b/tools/syz-testbed/html.go @@ -206,6 +206,16 @@ func (ctx *TestbedContext) httpMainBugTable(urlPrefix string, view *StatView, r }, nil } +func (ctx *TestbedContext) httpMainBugCountsTable(urlPrefix string, view *StatView, r *http.Request) (*uiTable, error) { + table, err := view.GenerateBugCountsTable() + if err != nil { + return nil, fmt.Errorf("bug counts table generation failed: %s", err) + } + return &uiTable{ + Table: table, + }, nil +} + func (ctx *TestbedContext) httpMain(w http.ResponseWriter, r *http.Request) { activeView, err := ctx.getCurrentStatView(r) if err != nil { @@ -225,8 +235,9 @@ func (ctx *TestbedContext) httpMain(w http.ResponseWriter, r *http.Request) { } uiView := uiStatView{Name: activeView.Name} uiView.TableTypes = map[string]uiTableType{ - "stats": uiTableType{"Statistics", ctx.httpMainStatsTable, genTableURL("stats")}, - "bugs": uiTableType{"Bugs", ctx.httpMainBugTable, genTableURL("bugs")}, + "stats": {"Statistics", ctx.httpMainStatsTable, genTableURL("stats")}, + "bugs": {"Bugs", ctx.httpMainBugTable, genTableURL("bugs")}, + "bug_counts": {"Bug Counts", ctx.httpMainBugCountsTable, genTableURL("bug_counts")}, } uiView.ActiveTableType = r.FormValue("table") if uiView.ActiveTableType == "" { diff --git a/tools/syz-testbed/stats.go b/tools/syz-testbed/stats.go index 20ad9bb30..1ff4af4d0 100644 --- a/tools/syz-testbed/stats.go +++ b/tools/syz-testbed/stats.go @@ -95,8 +95,9 @@ func groupSamples(records []StatRecord) map[string]*stats.Sample { } type BugSummary struct { - title string - found map[string]bool + title string + found map[string]bool + resultsCount map[string]int // the number of run results that have found this bug } // If there are several instances belonging to a single checkout, we're interested in the @@ -109,12 +110,14 @@ func summarizeBugs(groups []RunResultGroup) ([]*BugSummary, error) { summary := bugsMap[bug.Title] if summary == nil { summary = &BugSummary{ - title: bug.Title, - found: make(map[string]bool), + title: bug.Title, + found: make(map[string]bool), + resultsCount: make(map[string]int), } bugsMap[bug.Title] = summary } summary.found[group.Name] = true + summary.resultsCount[group.Name]++ } } } @@ -146,6 +149,28 @@ func (view StatView) GenerateBugTable() (*Table, error) { return table, nil } +func (view StatView) GenerateBugCountsTable() (*Table, error) { + table := NewTable("Bug") + for _, group := range view.Groups { + table.AddColumn(group.Name) + } + summaries, err := summarizeBugs(view.Groups) + if err != nil { + return nil, err + } + for _, bug := range summaries { + for _, group := range view.Groups { + if bug.found[group.Name] { + count := bug.resultsCount[group.Name] + percent := float64(count) / float64(len(group.Results)) * 100.0 + value := fmt.Sprintf("%v (%.1f%%)", count, percent) + table.Set(bug.title, group.Name, value) + } + } + } + return table, nil +} + func (group RunResultGroup) AvgStatRecords() []map[string]uint64 { ret := []map[string]uint64{} commonLen := group.minResultLength() |
