From 8219a518aefc8a87e16ffbec8cd06944a0160032 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Fri, 11 Feb 2022 10:54:41 +0000 Subject: tools/syz-testbed: introduce BoolCell cell type --- tools/syz-testbed/stats.go | 2 +- tools/syz-testbed/table.go | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'tools/syz-testbed') diff --git a/tools/syz-testbed/stats.go b/tools/syz-testbed/stats.go index 1ff4af4d0..0db75c45c 100644 --- a/tools/syz-testbed/stats.go +++ b/tools/syz-testbed/stats.go @@ -142,7 +142,7 @@ func (view StatView) GenerateBugTable() (*Table, error) { for _, bug := range summaries { for _, group := range view.Groups { if bug.found[group.Name] { - table.Set(bug.title, group.Name, "YES") + table.Set(bug.title, group.Name, NewBoolCell(true)) } } } diff --git a/tools/syz-testbed/table.go b/tools/syz-testbed/table.go index f8ead50fb..31312ac93 100644 --- a/tools/syz-testbed/table.go +++ b/tools/syz-testbed/table.go @@ -35,6 +35,10 @@ type RatioCell struct { TotalCount int } +type BoolCell struct { + Value bool +} + func NewValueCell(sample *stats.Sample) *ValueCell { return &ValueCell{Value: sample.Median(), Sample: sample} } @@ -55,6 +59,19 @@ func (c *RatioCell) String() string { return fmt.Sprintf("%d / %d", c.TrueCount, c.TotalCount) } +func NewBoolCell(value bool) *BoolCell { + return &BoolCell{ + Value: value, + } +} + +func (c *BoolCell) String() string { + if c.Value { + return "YES" + } + return "NO" +} + func NewTable(topLeft string, columns ...string) *Table { return &Table{ TopLeftHeader: topLeft, -- cgit mrf-deployment