Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: fuzzer/go/fuzzer-be/main.go

Issue 1691893002: Fuzzer now deduplicates on the analysis side instead of the download side (Closed) Base URL: https://skia.googlesource.com/buildbot@metrics
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fuzzer/go/fuzzcache/fuzzcache_test.go ('k') | fuzzer/go/fuzzer-fe/main.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 package main 1 package main
2 2
3 /* 3 /*
4 Runs the backend portions of the fuzzer. This includes the generator and aggreg ator parts (see DESIGN.md) 4 Runs the backend portions of the fuzzer. This includes the generator and aggreg ator parts (see DESIGN.md)
5 */ 5 */
6 6
7 import ( 7 import (
8 "flag" 8 "flag"
9 "fmt" 9 "fmt"
10 "os" 10 "os"
11 "path/filepath" 11 "path/filepath"
12 "time" 12 "time"
13 13
14 "github.com/skia-dev/glog" 14 "github.com/skia-dev/glog"
15 "go.skia.org/infra/fuzzer/go/aggregator" 15 "go.skia.org/infra/fuzzer/go/aggregator"
16 "go.skia.org/infra/fuzzer/go/backend" 16 "go.skia.org/infra/fuzzer/go/backend"
17 fcommon "go.skia.org/infra/fuzzer/go/common" 17 fcommon "go.skia.org/infra/fuzzer/go/common"
18 "go.skia.org/infra/fuzzer/go/config" 18 "go.skia.org/infra/fuzzer/go/config"
19 "go.skia.org/infra/fuzzer/go/data"
19 "go.skia.org/infra/fuzzer/go/generator" 20 "go.skia.org/infra/fuzzer/go/generator"
21 fstorage "go.skia.org/infra/fuzzer/go/storage"
20 "go.skia.org/infra/go/auth" 22 "go.skia.org/infra/go/auth"
21 "go.skia.org/infra/go/common" 23 "go.skia.org/infra/go/common"
22 "go.skia.org/infra/go/fileutil" 24 "go.skia.org/infra/go/fileutil"
23 "go.skia.org/infra/go/influxdb" 25 "go.skia.org/infra/go/influxdb"
24 "golang.org/x/net/context" 26 "golang.org/x/net/context"
25 "google.golang.org/cloud" 27 "google.golang.org/cloud"
26 "google.golang.org/cloud/storage" 28 "google.golang.org/cloud/storage"
27 ) 29 )
28 30
29 var ( 31 var (
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 81 }
80 if err := fcommon.DownloadSkiaVersionForFuzzing(storageClient, config.Ge nerator.SkiaRoot, &config.Generator); err != nil { 82 if err := fcommon.DownloadSkiaVersionForFuzzing(storageClient, config.Ge nerator.SkiaRoot, &config.Generator); err != nil {
81 glog.Fatalf("Problem downloading Skia: %s", err) 83 glog.Fatalf("Problem downloading Skia: %s", err)
82 } 84 }
83 85
84 fuzzPipelines := make([]backend.FuzzPipeline, 0, len(*fuzzesToRun)) 86 fuzzPipelines := make([]backend.FuzzPipeline, 0, len(*fuzzesToRun))
85 87
86 for _, category := range *fuzzesToRun { 88 for _, category := range *fuzzesToRun {
87 gen := generator.New(category) 89 gen := generator.New(category)
88 if err := gen.DownloadSeedFiles(storageClient); err != nil { 90 if err := gen.DownloadSeedFiles(storageClient); err != nil {
89 » » » glog.Fatalf("Problem downloading binary seed files: %s", err) 91 » » » glog.Fatalf("Problem downloading seed files: %s", err)
90 } 92 }
91 93
92 » » // If we are reanalyzing, no point in running the generator firs t, just to stop it. 94 » » var startingReports <-chan data.FuzzReport
95 » » // If we are reanalyzing, no point in running the generator firs t, just to stop it, nor
96 » » // is there reason to download all of the current fuzz reports.
93 if !*forceReanalysis { 97 if !*forceReanalysis {
94 glog.Infof("Starting %s generator with configuration %#v ", category, config.Generator) 98 glog.Infof("Starting %s generator with configuration %#v ", category, config.Generator)
95 » » » if err := gen.Start(); err != nil { 99 » » » var err error
96 » » » » glog.Fatalf("Problem starting binary generator: %s", err) 100 » » » if err = gen.Start(); err != nil {
101 » » » » glog.Fatalf("Problem starting generator: %s", er r)
102 » » » }
103 » » » glog.Infof("Downloading all bad %s fuzzes @%sto setup du plication detection", category, config.Generator.SkiaVersion.Hash)
104 » » » baseFolder := fmt.Sprintf("%s/%s/bad", category, config. Generator.SkiaVersion.Hash)
105 » » » if startingReports, err = fstorage.GetReportsFromGS(stor ageClient, baseFolder, category, nil, config.Generator.NumDownloadProcesses); er r != nil {
106 » » » » glog.Fatalf("Could not download previously found fuzzes for deduplication: %s", err)
97 } 107 }
98 } else { 108 } else {
99 » » » glog.Infof("Skipping %s generator because --skip_generat ion is enabled", category) 109 » » » glog.Infof("Skipping %s generator and deduplication setu p because --force_reanalysis is enabled", category)
110
100 } 111 }
101 112
102 glog.Infof("Starting %s aggregator with configuration %#v", cate gory, config.Aggregator) 113 glog.Infof("Starting %s aggregator with configuration %#v", cate gory, config.Aggregator)
103 » » agg, err := aggregator.StartAggregator(storageClient, category) 114 » » agg, err := aggregator.StartAggregator(storageClient, category, startingReports)
104 if err != nil { 115 if err != nil {
105 glog.Fatalf("Could not start aggregator: %s", err) 116 glog.Fatalf("Could not start aggregator: %s", err)
106 } 117 }
107 fuzzPipelines = append(fuzzPipelines, backend.FuzzPipeline{ 118 fuzzPipelines = append(fuzzPipelines, backend.FuzzPipeline{
108 Category: category, 119 Category: category,
109 Agg: agg, 120 Agg: agg,
110 Gen: gen, 121 Gen: gen,
111 }) 122 })
112 } 123 }
113 124
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 161 }
151 162
152 config.Common.VerboseBuilds = *verboseBuilds 163 config.Common.VerboseBuilds = *verboseBuilds
153 config.Common.ClangPath = *clangPath 164 config.Common.ClangPath = *clangPath
154 config.Common.ClangPlusPlusPath = *clangPlusPlusPath 165 config.Common.ClangPlusPlusPath = *clangPlusPlusPath
155 config.Common.DepotToolsPath = *depotToolsPath 166 config.Common.DepotToolsPath = *depotToolsPath
156 config.Generator.NumFuzzProcesses = *numFuzzProcesses 167 config.Generator.NumFuzzProcesses = *numFuzzProcesses
157 config.Generator.WatchAFL = *watchAFL 168 config.Generator.WatchAFL = *watchAFL
158 config.Generator.VersionCheckPeriod = *versionCheckPeriod 169 config.Generator.VersionCheckPeriod = *versionCheckPeriod
159 config.Generator.NumDownloadProcesses = *downloadProcesses 170 config.Generator.NumDownloadProcesses = *downloadProcesses
171 config.Generator.SkipGeneration = *skipGeneration
160 172
161 config.GS.Bucket = *bucket 173 config.GS.Bucket = *bucket
162 config.Aggregator.FuzzPath, err = fileutil.EnsureDirExists(*fuzzPath) 174 config.Aggregator.FuzzPath, err = fileutil.EnsureDirExists(*fuzzPath)
163 if err != nil { 175 if err != nil {
164 return err 176 return err
165 } 177 }
166 config.Aggregator.ExecutablePath, err = fileutil.EnsureDirExists(*execut ablePath) 178 config.Aggregator.ExecutablePath, err = fileutil.EnsureDirExists(*execut ablePath)
167 if err != nil { 179 if err != nil {
168 return err 180 return err
169 } 181 }
(...skipping 17 matching lines...) Expand all
187 client, err := auth.NewDefaultJWTServiceAccountClient(auth.SCOPE_READ_WR ITE) 199 client, err := auth.NewDefaultJWTServiceAccountClient(auth.SCOPE_READ_WR ITE)
188 if err != nil { 200 if err != nil {
189 return fmt.Errorf("Problem setting up client OAuth: %v", err) 201 return fmt.Errorf("Problem setting up client OAuth: %v", err)
190 } 202 }
191 203
192 if storageClient, err = storage.NewClient(context.Background(), cloud.Wi thBaseHTTP(client)); err != nil { 204 if storageClient, err = storage.NewClient(context.Background(), cloud.Wi thBaseHTTP(client)); err != nil {
193 return fmt.Errorf("Problem authenticating: %v", err) 205 return fmt.Errorf("Problem authenticating: %v", err)
194 } 206 }
195 return nil 207 return nil
196 } 208 }
OLDNEW
« no previous file with comments | « fuzzer/go/fuzzcache/fuzzcache_test.go ('k') | fuzzer/go/fuzzer-fe/main.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698