aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorGrigory Bazilevich <g.bazilevich@ispras.ru>2026-03-12 10:50:46 +0300
committerGrigory Bazilevich <g.bazilevich@ispras.ru>2026-03-12 11:30:09 +0300
commita0d21425bbfff7ba2e95d6338f551357c67cdba0 (patch)
tree8aed5afcc3807a94d4211d8db1b460482d7c769a /pkg
parente202199958896677bd40ae065d470035b5490524 (diff)
syz-ci: make rebuild periods configurable
Signed-off-by: Denis Efremov <efremov@ispras.ru>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/updater/updater.go73
1 files changed, 38 insertions, 35 deletions
diff --git a/pkg/updater/updater.go b/pkg/updater/updater.go
index 6cf56c63d..fc575a004 100644
--- a/pkg/updater/updater.go
+++ b/pkg/updater/updater.go
@@ -20,8 +20,8 @@ import (
)
const (
- RebuildPeriod = 12 * time.Hour
- BuildRetryPeriod = 10 * time.Minute // used for both syzkaller and kernel
+ DefaultRebuildPeriod = 12 * time.Hour
+ BuildRetryPeriod = 10 * time.Minute // used for both syzkaller and kernel
)
// Updater handles everything related to syzkaller updates.
@@ -32,30 +32,32 @@ const (
// Additionally it updates and restarts the current executable as necessary.
// Current executable is always built on the same revision as the rest of syzkaller binaries.
type Updater struct {
- repo vcs.Repo
- exe string
- repoAddress string
- branch string
- descriptions string
- gopathDir string
- syzkallerDir string
- latestDir string
- currentDir string
- syzFiles map[string]bool
- compilerID string
- cfg *Config
+ repo vcs.Repo
+ exe string
+ repoAddress string
+ branch string
+ descriptions string
+ rebuildPeriod time.Duration
+ gopathDir string
+ syzkallerDir string
+ latestDir string
+ currentDir string
+ syzFiles map[string]bool
+ compilerID string
+ cfg *Config
}
type Config struct {
// If set, exit on updates instead of restarting the current binary.
- ExitOnUpdate bool
- BuildSem *osutil.Semaphore
- ReportBuildError func(commit *vcs.Commit, compilerID string, buildErr error)
- SyzkallerRepo string
- SyzkallerBranch string
- SyzkallerDescriptions string
- Targets map[Target]bool
- MakeTargets []string // host make targets to build besides the targets-specific ones
+ ExitOnUpdate bool
+ BuildSem *osutil.Semaphore
+ ReportBuildError func(commit *vcs.Commit, compilerID string, buildErr error)
+ SyzkallerRepo string
+ SyzkallerBranch string
+ SyzkallerDescriptions string
+ SyzkallerRebuildPeriod int
+ Targets map[Target]bool
+ MakeTargets []string // host make targets to build besides the targets-specific ones
}
type Target struct {
@@ -107,18 +109,19 @@ func New(cfg *Config) (*Updater, error) {
return nil, err
}
return &Updater{
- repo: vcs.NewSyzkallerRepo(syzkallerDir),
- exe: exe,
- repoAddress: cfg.SyzkallerRepo,
- branch: cfg.SyzkallerBranch,
- descriptions: cfg.SyzkallerDescriptions,
- gopathDir: gopath,
- syzkallerDir: syzkallerDir,
- latestDir: filepath.Join("syzkaller", "latest"),
- currentDir: filepath.Join("syzkaller", "current"),
- syzFiles: syzFiles,
- compilerID: strings.TrimSpace(string(compilerID)),
- cfg: cfg,
+ repo: vcs.NewSyzkallerRepo(syzkallerDir),
+ exe: exe,
+ repoAddress: cfg.SyzkallerRepo,
+ branch: cfg.SyzkallerBranch,
+ descriptions: cfg.SyzkallerDescriptions,
+ rebuildPeriod: time.Duration(cfg.SyzkallerRebuildPeriod) * time.Second,
+ gopathDir: gopath,
+ syzkallerDir: syzkallerDir,
+ latestDir: filepath.Join("syzkaller", "latest"),
+ currentDir: filepath.Join("syzkaller", "current"),
+ syzFiles: syzFiles,
+ compilerID: strings.TrimSpace(string(compilerID)),
+ cfg: cfg,
}, nil
}
@@ -195,7 +198,7 @@ func (upd *Updater) UpdateOnStart(autoupdate bool, updatePending, shutdown chan
// waitForUpdate polls and rebuilds syzkaller.
// Returns when we have a new good build in latest.
func (upd *Updater) waitForUpdate() {
- time.Sleep(RebuildPeriod)
+ time.Sleep(upd.rebuildPeriod)
latestTag := upd.checkLatest()
lastCommit := latestTag
for {