Skip to content

Commit dd170fc

Browse files
committed
pkg/manager: store status in the diff storage
1 parent b1fba58 commit dd170fc

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

pkg/manager/diff/manager.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,17 @@ loop:
191191
}
192192
log.Logf(1, "found repro for %q (orig title: %q, reliability: %2.f), took %.2f minutes",
193193
ret.Repro.Report.Title, origTitle, ret.Repro.Reliability, ret.Stats.TotalTime.Minutes())
194+
195+
dc.store.UpdateStatus(ret.Repro.Report.Title, manager.DiffBugStatusVerifying)
196+
194197
g.Go(func() error {
195198
runner.Run(groupCtx, ret.Repro, ret.Crash.FullRepro)
196199
return nil
197200
})
198201
} else {
199202
origTitle := ret.Crash.Report.Title
200203
log.Logf(1, "failed repro for %q, err=%s", origTitle, ret.Err)
204+
dc.store.UpdateStatus(origTitle, manager.DiffBugStatusCompleted)
201205
}
202206
dc.store.SaveRepro(ret)
203207
case rep := <-dc.new.crashes:
@@ -208,7 +212,10 @@ loop:
208212
rep.Title, need)
209213
dc.store.PatchedCrashed(rep.Title, rep.Report, rep.Output)
210214
if need {
215+
dc.store.UpdateStatus(rep.Title, manager.DiffBugStatusVerifying)
211216
reproLoop.Enqueue(crash)
217+
} else {
218+
dc.store.UpdateStatus(rep.Title, manager.DiffBugStatusIgnored)
212219
}
213220
}
214221
}

pkg/manager/diff_store.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,18 @@ import (
1616
"github.com/google/syzkaller/pkg/osutil"
1717
)
1818

19+
type DiffBugStatus string
20+
21+
const (
22+
DiffBugStatusPending DiffBugStatus = "pending"
23+
DiffBugStatusVerifying DiffBugStatus = "verifying"
24+
DiffBugStatusCompleted DiffBugStatus = "completed"
25+
DiffBugStatusIgnored DiffBugStatus = "ignored"
26+
)
27+
1928
type DiffBug struct {
2029
Title string
30+
Status DiffBugStatus
2131
Base DiffBugInfo
2232
Patched DiffBugInfo
2333
}
@@ -49,8 +59,15 @@ type DiffFuzzerStore struct {
4959
bugs map[string]*DiffBug
5060
}
5161

62+
func (s *DiffFuzzerStore) UpdateStatus(title string, status DiffBugStatus) {
63+
s.patch(title, func(obj *DiffBug) {
64+
obj.Status = status
65+
})
66+
}
67+
5268
func (s *DiffFuzzerStore) BaseCrashed(title string, report []byte) {
5369
s.patch(title, func(obj *DiffBug) {
70+
obj.Status = DiffBugStatusCompleted
5471
obj.Base.Crashes++
5572
if len(report) > 0 {
5673
obj.Base.Report = s.saveFile(title, "base_report", report)
@@ -67,6 +84,7 @@ func (s *DiffFuzzerStore) EverCrashedBase(title string) bool {
6784

6885
func (s *DiffFuzzerStore) BaseNotCrashed(title string) {
6986
s.patch(title, func(obj *DiffBug) {
87+
obj.Status = DiffBugStatusCompleted
7088
if obj.Base.Crashes == 0 {
7189
obj.Base.NotCrashed = true
7290
}
@@ -131,7 +149,7 @@ func (s *DiffFuzzerStore) PlainTextDump() []byte {
131149
})
132150
var buf bytes.Buffer
133151
w := tabwriter.NewWriter(&buf, 0, 0, 1, ' ', 0)
134-
fmt.Fprintln(w, "Title\tOn-Base\tOn-Patched")
152+
fmt.Fprintln(w, "Title\tOn-Base\tOn-Patched\tStatus")
135153

136154
printInfo := func(info *DiffBugInfo) {
137155
if info.Crashes > 0 {
@@ -147,7 +165,7 @@ func (s *DiffFuzzerStore) PlainTextDump() []byte {
147165
printInfo(&item.Base)
148166
fmt.Fprintf(w, "\t")
149167
printInfo(&item.Patched)
150-
fmt.Fprintf(w, "\n")
168+
fmt.Fprintf(w, "\t%s\n", item.Status)
151169
}
152170
w.Flush()
153171
return buf.Bytes()

0 commit comments

Comments
 (0)