From 9b05a0a131fdfb47696fe0d8967fd5bc6d8d5112 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 22 Feb 2019 18:40:51 +0100 Subject: syz-ci: add a flag to disable auto-update Useful for local testing. With -autoupdate=0 syz-ci does not need syzkaller repo, will not poll, build and update itself. So a binary with local changes can be tested without pushing changes to some git repo. --- syz-ci/syz-ci.go | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/syz-ci/syz-ci.go b/syz-ci/syz-ci.go index ef4648bf6..2c10fc992 100644 --- a/syz-ci/syz-ci.go +++ b/syz-ci/syz-ci.go @@ -69,7 +69,10 @@ import ( "github.com/google/syzkaller/pkg/osutil" ) -var flagConfig = flag.String("config", "", "config file") +var ( + flagConfig = flag.String("config", "", "config file") + flagAutoUpdate = flag.Bool("autoupdate", true, "auto-update the binary") +) type Config struct { Name string `json:"name"` @@ -126,13 +129,17 @@ func main() { serveHTTP(cfg) - updater := NewSyzUpdater(cfg) - updater.UpdateOnStart(shutdownPending) updatePending := make(chan struct{}) - go func() { - updater.WaitForUpdate() - close(updatePending) - }() + var autoUpdate func() + if *flagAutoUpdate { + updater := NewSyzUpdater(cfg) + updater.UpdateOnStart(shutdownPending) + go func() { + updater.WaitForUpdate() + autoUpdate = updater.UpdateAndRestart + close(updatePending) + }() + } var wg sync.WaitGroup wg.Add(1) @@ -183,7 +190,7 @@ func main() { select { case <-shutdownPending: case <-updatePending: - updater.UpdateAndRestart() + autoUpdate() } } -- cgit mrf-deployment