OLD | NEW |
1 package data | 1 package data |
2 | 2 |
3 import ( | 3 import ( |
4 "bytes" | 4 "bytes" |
5 "encoding/gob" | 5 "encoding/gob" |
6 "fmt" | 6 "fmt" |
7 "sort" | 7 "sort" |
8 "sync" | 8 "sync" |
9 | 9 |
10 "github.com/skia-dev/glog" | 10 "github.com/skia-dev/glog" |
(...skipping 14 matching lines...) Loading... |
25 LineNumbers []LineFuzzReport `json:"byLineNumber"` | 25 LineNumbers []LineFuzzReport `json:"byLineNumber"` |
26 } | 26 } |
27 | 27 |
28 type LineFuzzReport struct { | 28 type LineFuzzReport struct { |
29 LineNumber int `json:"lineNumber"` | 29 LineNumber int `json:"lineNumber"` |
30 Count int `json:"count"` | 30 Count int `json:"count"` |
31 Details SortedFuzzReports `json:"reports"` | 31 Details SortedFuzzReports `json:"reports"` |
32 } | 32 } |
33 | 33 |
34 type FuzzReport struct { | 34 type FuzzReport struct { |
35 » DebugStackTrace StackTrace `json:"debugStackTrace"` | 35 » DebugStackTrace StackTrace `json:"debugStackTrace"` |
36 » ReleaseStackTrace StackTrace `json:"releaseStackTrace"` | 36 » ReleaseStackTrace StackTrace `json:"releaseStackTrace"` |
37 » HumanReadableFlags []string `json:"flags"` | 37 » DebugFlags []string `json:"debugFlags"` |
| 38 » ReleaseFlags []string `json:"releaseFlags"` |
38 | 39 |
39 FuzzName string `json:"fuzzName"` | 40 FuzzName string `json:"fuzzName"` |
40 FuzzCategory string `json:"category"` | 41 FuzzCategory string `json:"category"` |
41 } | 42 } |
42 | 43 |
43 type SortedFuzzReports []FuzzReport | 44 type SortedFuzzReports []FuzzReport |
44 | 45 |
45 // ParseReport creates a report given the raw materials passed in. | 46 // ParseReport creates a report given the raw materials passed in. |
46 func ParseReport(fuzzName, debugDump, debugErr, releaseDump, releaseErr string)
FuzzReport { | 47 func ParseReport(g GCSPackage) FuzzReport { |
47 » result := ParseFuzzResult(debugDump, debugErr, releaseDump, releaseErr) | 48 » result := ParseGCSPackage(g) |
48 return FuzzReport{ | 49 return FuzzReport{ |
49 » » DebugStackTrace: result.DebugStackTrace, | 50 » » DebugStackTrace: result.Debug.StackTrace, |
50 » » ReleaseStackTrace: result.ReleaseStackTrace, | 51 » » ReleaseStackTrace: result.Release.StackTrace, |
51 » » HumanReadableFlags: result.Flags.ToHumanReadableFlags(), | 52 » » DebugFlags: result.Debug.Flags.ToHumanReadableFlags(), |
52 » » FuzzName: fuzzName, | 53 » » ReleaseFlags: result.Release.Flags.ToHumanReadableFlags(), |
53 » » FuzzCategory: "", // Will be filled in later, when added t
o the tree | 54 » » FuzzName: g.Name, |
| 55 » » FuzzCategory: g.FuzzCategory, |
54 } | 56 } |
55 } | 57 } |
56 | 58 |
57 // treeReportBuilder is an in-memory structure that allows easy creation of a tr
ee of reports | 59 // treeReportBuilder is an in-memory structure that allows easy creation of a tr
ee of reports |
58 // for use on the frontend. It has a fuzzReportCache for every fuzz type (e.g. s
kpicture, skcodec, etc) | 60 // for use on the frontend. It has a fuzzReportCache for every fuzz type (e.g. s
kpicture, skcodec, etc) |
59 type treeReportBuilder struct { | 61 type treeReportBuilder struct { |
60 caches map[string]*fuzzReportCache | 62 caches map[string]*fuzzReportCache |
61 mutex sync.Mutex | 63 mutex sync.Mutex |
62 } | 64 } |
63 | 65 |
(...skipping 418 matching lines...) Loading... |
482 } | 484 } |
483 | 485 |
484 // containsName returns the FuzzReport and true if a fuzz with the given name is
in the list. | 486 // containsName returns the FuzzReport and true if a fuzz with the given name is
in the list. |
485 func (p SortedFuzzReports) containsName(fuzzName string) (FuzzReport, bool) { | 487 func (p SortedFuzzReports) containsName(fuzzName string) (FuzzReport, bool) { |
486 i := sort.Search(len(p), func(i int) bool { return p[i].FuzzName >= fuzz
Name }) | 488 i := sort.Search(len(p), func(i int) bool { return p[i].FuzzName >= fuzz
Name }) |
487 if i < len(p) && p[i].FuzzName == fuzzName { | 489 if i < len(p) && p[i].FuzzName == fuzzName { |
488 return p[i], true | 490 return p[i], true |
489 } | 491 } |
490 return FuzzReport{}, false | 492 return FuzzReport{}, false |
491 } | 493 } |
OLD | NEW |