aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-07-21 09:43:01 +0200
committerDmitry Vyukov <dvyukov@google.com>2017-07-21 10:06:46 +0200
commit0f42bbec240714ea93feff8e86c707f97e19f6f7 (patch)
treeab67f8391663a50d8a73821e045b8c6f08f21f0c
parent1a3751c444d733fa77c6093f68ac86f4faaecdbe (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.
-rw-r--r--dashboard/dashapi/dashapi.go71
-rw-r--r--syz-ci/manager.go5
2 files changed, 72 insertions, 4 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)
diff --git a/syz-ci/manager.go b/syz-ci/manager.go
index 0d6a49ca8..b530a4813 100644
--- a/syz-ci/manager.go
+++ b/syz-ci/manager.go
@@ -78,7 +78,7 @@ func createManager(cfg *Config, mgrcfg *ManagerConfig, stop chan struct{}) *Mana
}
mgr := &Manager{
- name: mgrcfg.Name,
+ name: cfg.Name + "-" + mgrcfg.Name,
workDir: filepath.Join(dir, "workdir"),
kernelDir: filepath.Join(dir, "kernel"),
currentDir: filepath.Join(dir, "current"),
@@ -324,7 +324,7 @@ func (mgr *Manager) writeConfig(info *BuildInfo) (string, error) {
// at least some useful information.
mgrcfg.Tag = info.KernelCommit
}
- mgrcfg.Name = mgr.cfg.Name + "-" + mgr.name
+ mgrcfg.Name = mgr.name
if mgr.cfg.Hub_Addr != "" {
mgrcfg.Hub_Client = mgr.cfg.Name
mgrcfg.Hub_Addr = mgr.cfg.Hub_Addr
@@ -364,6 +364,7 @@ func (mgr *Manager) uploadBuild(info *BuildInfo) error {
return fmt.Errorf("failed to read kernel.config: %v", err)
}
build := &dashapi.Build{
+ Manager: mgr.name,
ID: info.Tag,
SyzkallerCommit: syzkallerCommit,
CompilerID: info.CompilerID,