Skip to content

Commit

Permalink
syz-ci: add a flag to disable auto-update
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dvyukov committed Feb 22, 2019
1 parent b198b1e commit 9b05a0a
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions syz-ci/syz-ci.go
Expand Up @@ -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"`
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -183,7 +190,7 @@ func main() {
select {
case <-shutdownPending:
case <-updatePending:
updater.UpdateAndRestart()
autoUpdate()
}
}

Expand Down

1 comment on commit 9b05a0a

@dvyukov
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flowerhack if you still run syz-ci locally, you may find this useful.
It requires a working syzkaller build in syzkaller/latest, but then a custom syz-ci binary can be tested and it won't autoupdate.

Please sign in to comment.