diff options
| author | Jouni Hogander <jouni.hogander@unikie.com> | 2020-10-23 10:51:02 +0300 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-10-24 13:14:08 +0200 |
| commit | a1839e81524f4e427a4b57bca0e4633d459d3d18 (patch) | |
| tree | 9d5eb9db806ec018accd69cd9c4199b2bab32ed6 | |
| parent | 2bb6666ca878753e46b201c508b64e338668694a (diff) | |
tools/syz-reporter: add summary and reproducer information
| -rw-r--r-- | dashboard/app/static/common.js | 1 | ||||
| -rw-r--r-- | pkg/html/generated.go | 1 | ||||
| -rw-r--r-- | tools/syz-reporter/reporter.go | 42 |
3 files changed, 32 insertions, 12 deletions
diff --git a/dashboard/app/static/common.js b/dashboard/app/static/common.js index ec5a5c767..6b15290b1 100644 --- a/dashboard/app/static/common.js +++ b/dashboard/app/static/common.js @@ -43,6 +43,7 @@ function numSort(v) { return -parseInt(v); } function floatSort(v) { return -parseFloat(v); } function reproSort(v) { return v == "C" ? 0 : v == "syz" ? 1 : 2; } function patchedSort(v) { return v == "" ? -1 : parseInt(v); } +function lineSort(v) { return -v.split(/\r\n|\r|\n/g).length } function timeSort(v) { if (v == "now") diff --git a/pkg/html/generated.go b/pkg/html/generated.go index 5db49d857..1ed211ffc 100644 --- a/pkg/html/generated.go +++ b/pkg/html/generated.go @@ -260,6 +260,7 @@ function numSort(v) { return -parseInt(v); } function floatSort(v) { return -parseFloat(v); } function reproSort(v) { return v == "C" ? 0 : v == "syz" ? 1 : 2; } function patchedSort(v) { return v == "" ? -1 : parseInt(v); } +function lineSort(v) { return -v.split(/\r\n|\r|\n/g).length } function timeSort(v) { if (v == "now") diff --git a/tools/syz-reporter/reporter.go b/tools/syz-reporter/reporter.go index 948809ea7..6173dcf36 100644 --- a/tools/syz-reporter/reporter.go +++ b/tools/syz-reporter/reporter.go @@ -34,16 +34,18 @@ var ( ) type UISummaryData struct { - Name string - Crashes []*UICrashType - Workdir string + Name string + Crashes []*UICrashType + CrashCount int + CrashCountReproducers int + Workdir string } type UICrashType struct { Description string ID string Count int - Tags map[string]string + Reproducers map[string]string Crashes []*UICrash } @@ -90,6 +92,14 @@ func httpSummary(w io.Writer, cfg *mgrconfig.Config) error { return fmt.Errorf("failed to collect crashes: %v", err) } + data.CrashCount = len(data.Crashes) + + for _, crash := range data.Crashes { + if len(crash.Reproducers) > 0 { + data.CrashCountReproducers = data.CrashCountReproducers + 1 + } + } + if err = summaryTemplate.Execute(w, data); err != nil { return fmt.Errorf("failed to execute template: %v", err) } @@ -139,7 +149,7 @@ func readCrash(workdir, dir string) *UICrashType { } var crashes []*UICrash - tags := make(map[string]string) + reproducers := make(map[string]string) for _, f := range files { if strings.HasPrefix(f, "log") { index, err := strconv.ParseUint(f[3:], 10, 64) @@ -153,16 +163,20 @@ func readCrash(workdir, dir string) *UICrashType { if strings.HasPrefix(f, "tag") { tag, err := ioutil.ReadFile(filepath.Join(crashdir, dir, f)) if err == nil { - tags[string(tag)] = string(tag) + reproducers[string(tag)] = string(tag) } } + + if strings.HasSuffix(f, "prog") { + reproducers[f] = f + } } return &UICrashType{ Description: desc, ID: dir, Count: len(crashes), - Tags: tags, + Reproducers: reproducers, Crashes: crashes, } } @@ -186,22 +200,26 @@ var summaryTemplate = html.CreatePage(` <br> <b>Workdir: {{.Workdir }}</b> <br> +<b>Crash Count: {{ .CrashCount }}</b> +<br> +<b>Crash With Reproducers Count: {{ .CrashCountReproducers }}</b> +<br> <table class="list_table"> <caption>Crashes:</caption> <tr> <th><a onclick="return sortTable(this, 'Description', textSort)" href="#">Description</a></th> <th><a onclick="return sortTable(this, 'Count', numSort)" href="#">Count</a></th> - <th><a onclick="return sortTable(this, 'Tags', textSort)" href="#">Tags</a></th> + <th><a onclick="return sortTable(this, 'Reproducers', lineSort)" href="#">Reproducers</a></th> </tr> {{range $c := $.Crashes}} <tr> <td class="title">{{$c.Description}}</td> <td class="stat">{{$c.Count}}</td> - <td class="tags"> - {{range $tag := $c.Tags}} - {{$tag}}</br> - {{end}} + <td class="reproducer"> + {{range $reproducer := $c.Reproducers}} + {{$reproducer}}</br> + {{end}} </td> </tr> {{end}} |
