aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2019-02-22 18:40:51 +0100
committerDmitry Vyukov <dvyukov@google.com>2019-02-22 18:40:51 +0100
commit9b05a0a131fdfb47696fe0d8967fd5bc6d8d5112 (patch)
tree681f340027f01916a7960327e7483ad356d52307
parentb198b1edefd4e3890810717b72b12ddb2d612963 (diff)
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.
-rw-r--r--syz-ci/syz-ci.go23
1 files 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()
}
}