OLD | NEW |
1 package syncer | 1 package syncer |
2 | 2 |
3 import ( | 3 import ( |
4 "fmt" | 4 "fmt" |
5 "sort" | 5 "sort" |
6 "strings" | 6 "strings" |
7 "sync" | 7 "sync" |
8 "time" | 8 "time" |
9 | 9 |
10 "github.com/skia-dev/glog" | 10 "github.com/skia-dev/glog" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 return "", err | 125 return "", err |
126 } | 126 } |
127 glog.Infof("Most recent old version found to be %s", newestHash) | 127 glog.Infof("Most recent old version found to be %s", newestHash) |
128 return newestHash, nil | 128 return newestHash, nil |
129 } | 129 } |
130 | 130 |
131 // updateLoadedBinaryFuzzes uses gsLoader to download the fuzzes that are curren
tly not | 131 // updateLoadedBinaryFuzzes uses gsLoader to download the fuzzes that are curren
tly not |
132 // in the fuzz report tree / cache. | 132 // in the fuzz report tree / cache. |
133 func (f *FuzzSyncer) updateLoadedBinaryFuzzes(currentBadFuzzHashes []string) err
or { | 133 func (f *FuzzSyncer) updateLoadedBinaryFuzzes(currentBadFuzzHashes []string) err
or { |
134 if f.gsLoader == nil { | 134 if f.gsLoader == nil { |
135 » » glog.Info("Skipping update because the finder/cache hasn't been
set yet") | 135 » » glog.Info("Skipping update because the cache hasn't been set yet
") |
136 return nil | 136 return nil |
137 } | 137 } |
138 prevBadFuzzNames, err := f.gsLoader.Cache.LoadFuzzNames(config.FrontEnd.
SkiaVersion.Hash) | 138 prevBadFuzzNames, err := f.gsLoader.Cache.LoadFuzzNames(config.FrontEnd.
SkiaVersion.Hash) |
139 if err != nil { | 139 if err != nil { |
140 return fmt.Errorf("Could not load previous fuzz hashes from cach
e at revision %s: %s", config.FrontEnd.SkiaVersion.Hash, err) | 140 return fmt.Errorf("Could not load previous fuzz hashes from cach
e at revision %s: %s", config.FrontEnd.SkiaVersion.Hash, err) |
141 } | 141 } |
142 sort.Strings(currentBadFuzzHashes) | 142 sort.Strings(currentBadFuzzHashes) |
143 sort.Strings(prevBadFuzzNames) | 143 sort.Strings(prevBadFuzzNames) |
144 | 144 |
145 newBinaryFuzzNames := make([]string, 0, 10) | 145 newBinaryFuzzNames := make([]string, 0, 10) |
146 for _, h := range currentBadFuzzHashes { | 146 for _, h := range currentBadFuzzHashes { |
147 if i := sort.SearchStrings(prevBadFuzzNames, h); i < len(prevBad
FuzzNames) && prevBadFuzzNames[i] == h { | 147 if i := sort.SearchStrings(prevBadFuzzNames, h); i < len(prevBad
FuzzNames) && prevBadFuzzNames[i] == h { |
148 continue | 148 continue |
149 } | 149 } |
150 newBinaryFuzzNames = append(newBinaryFuzzNames, h) | 150 newBinaryFuzzNames = append(newBinaryFuzzNames, h) |
151 } | 151 } |
152 | 152 |
153 glog.Infof("%d newly found fuzzes from Google Storage. Going to load th
em.", len(newBinaryFuzzNames)) | 153 glog.Infof("%d newly found fuzzes from Google Storage. Going to load th
em.", len(newBinaryFuzzNames)) |
154 if len(newBinaryFuzzNames) > 0 { | 154 if len(newBinaryFuzzNames) > 0 { |
155 return f.gsLoader.LoadBinaryFuzzesFromGoogleStorage(newBinaryFuz
zNames) | 155 return f.gsLoader.LoadBinaryFuzzesFromGoogleStorage(newBinaryFuz
zNames) |
156 } | 156 } |
157 return nil | 157 return nil |
158 } | 158 } |
159 | 159 |
160 func (f *FuzzSyncer) LastCount(category string) FuzzCount { | 160 func (f *FuzzSyncer) LastCount(category string) FuzzCount { |
161 return f.lastCount[category] | 161 return f.lastCount[category] |
162 } | 162 } |
OLD | NEW |