aboutsummaryrefslogtreecommitdiffstats
path: root/syz-verifier/main.go
diff options
context:
space:
mode:
authorMara Mihali <maramihali@google.com>2021-07-16 10:20:59 +0000
committermaramihali <maramihali@google.com>2021-07-19 14:47:11 +0300
commitb8e37dc1fbe8fe39f929cb3157a2ed2edee335e3 (patch)
tree48f41acc4241ca762b9b966c3923af79707c507a /syz-verifier/main.go
parenta2851bc44ef2a22349b2bdf7252615744664b5fc (diff)
syz-verifier: add flag to specify stats output location
Diffstat (limited to 'syz-verifier/main.go')
-rwxr-xr-xsyz-verifier/main.go17
1 files changed, 16 insertions, 1 deletions
diff --git a/syz-verifier/main.go b/syz-verifier/main.go
index ed1841292..ca712b7df 100755
--- a/syz-verifier/main.go
+++ b/syz-verifier/main.go
@@ -57,6 +57,7 @@ type Verifier struct {
reasons map[*prog.Syscall]string
reportReasons bool
stats *stats.Stats
+ statsWrite io.Writer
}
// RPCServer is a wrapper around the rpc.Server. It communicates with Runners,
@@ -104,6 +105,8 @@ func main() {
var cfgs tool.CfgsFlag
flag.Var(&cfgs, "configs", "list of kernel-specific comma-sepatated configuration files ")
flagDebug := flag.Bool("debug", false, "dump all VM output to console")
+ flagStats := flag.String("stats", "", "where stats will be written when"+
+ "execution of syz-verifier finishes, defaults to stdout")
flag.Parse()
pools := make(map[int]*poolInfo)
for idx, cfg := range cfgs {
@@ -164,6 +167,18 @@ func main() {
resultsdir := filepath.Join(workdir, "results")
osutil.MkdirAll(resultsdir)
+ var sw io.Writer
+ var err error
+ if *flagStats == "" {
+ sw = os.Stdout
+ } else {
+ statsFile := filepath.Join(workdir, *flagStats)
+ sw, err = os.Create(statsFile)
+ if err != nil {
+ log.Fatalf("failed to create stats output file: %v", err)
+ }
+ }
+
for idx, pi := range pools {
var err error
pi.Reporter, err = report.NewReporter(pi.cfg)
@@ -298,7 +313,7 @@ func (srv *RPCServer) UpdateUnsupported(a *rpctype.UpdateUnsupportedArgs, r *int
srv.notChecked--
if srv.notChecked == 0 {
vrf.finalizeCallSet(os.Stdout)
- vrf.stats = stats.InitStats(vrf.calls, os.Stdout)
+ vrf.stats = stats.InitStats(vrf.calls, vrf.statsWrite)
vrf.choiceTable = vrf.target.BuildChoiceTable(nil, vrf.calls)
srv.cond.Signal()
}