diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2017-07-21 09:43:01 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-07-21 10:06:46 +0200 |
| commit | 0f42bbec240714ea93feff8e86c707f97e19f6f7 (patch) | |
| tree | ab67f8391663a50d8a73821e045b8c6f08f21f0c /dashboard | |
| parent | 1a3751c444d733fa77c6093f68ac86f4faaecdbe (diff) | |
syz-ci: extend dashboard interface
1. Add manager name to builds.
2. Add centralized logging.
3. Add types for bug reports and bug updates.
Diffstat (limited to 'dashboard')
| -rw-r--r-- | dashboard/dashapi/dashapi.go | 71 |
1 files changed, 69 insertions, 2 deletions
diff --git a/dashboard/dashapi/dashapi.go b/dashboard/dashapi/dashapi.go index 41f609cc5..9565402c6 100644 --- a/dashboard/dashapi/dashapi.go +++ b/dashboard/dashapi/dashapi.go @@ -33,6 +33,7 @@ func New(client, addr, key string) *Dashboard { // Build describes all aspects of a kernel build. type Build struct { + Manager string ID string SyzkallerCommit string CompilerID string @@ -75,6 +76,71 @@ func (dash *Dashboard) ReportFailedRepro(repro *FailedRepro) error { return dash.query("report_failed_repro", repro, nil) } +type LogEntry struct { + Name string + Text string +} + +// Centralized logging on dashboard. +func (dash *Dashboard) LogError(name, msg string, args ...interface{}) { + req := &LogEntry{ + Name: name, + Text: fmt.Sprintf(msg, args...), + } + dash.query("log_error", req, nil) +} + +// BugReport describes a single bug. +// Used by dashboard external reporting. +type BugReport struct { + Config []byte + ID string + Title string + Maintainers []string + CompilerID string + KernelRepo string + KernelBranch string + KernelCommit string + Log []byte + Report []byte + KernelConfig []byte + ReproC []byte + ReproSyz []byte +} + +type BugUpdate struct { + ID string + Status BugStatus + ReproLevel ReproLevel + DupOf string +} + +type PollRequest struct { + Type string +} + +type PollResponse struct { + Reports []*BugReport +} + +type ( + BugStatus int + ReproLevel int +) + +const ( + BugStatusOpen BugStatus = iota + BugStatusUpstream + BugStatusInvalid + BugStatusDup +) + +const ( + ReproLevelNone ReproLevel = iota + ReproLevelSyz + ReproLevelC +) + func (dash *Dashboard) query(method string, req, reply interface{}) error { values := make(url.Values) values.Add("client", dash.Client) @@ -87,8 +153,9 @@ func (dash *Dashboard) query(method string, req, reply interface{}) error { if err != nil { return fmt.Errorf("failed to marshal request: %v", err) } - if strings.HasPrefix(dash.Addr, "http://localhost:") { - // This is probably dev_appserver which does not support gzip. + if len(data) < 100 || strings.HasPrefix(dash.Addr, "http://localhost:") { + // Don't bother compressing tiny requests. + // Don't compress for dev_appserver which does not support gzip. body = bytes.NewReader(data) } else { buf := new(bytes.Buffer) |
