Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syz-ci: use random ports for test instances #4829

Merged
merged 1 commit into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions syz-ci/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,9 @@ func (mgr *Manager) createTestConfig(imageDir string, info *BuildInfo) (*mgrconf
*mgrcfg = *mgr.managercfg
mgrcfg.Name += "-test"
mgrcfg.Tag = info.KernelCommit
// Use random free ports to not collide with the actual manager.
mgrcfg.HTTP = fmt.Sprintf("localhost:%v", mgr.mgrcfg.testHTTPPort)
mgrcfg.RPC = fmt.Sprintf("localhost:%v", mgr.mgrcfg.testRPCPort)
mgrcfg.Workdir = filepath.Join(imageDir, "workdir")
if err := instance.SetConfigImage(mgrcfg, imageDir, true); err != nil {
return nil, err
Expand Down
10 changes: 10 additions & 0 deletions syz-ci/syz-ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ type Config struct {
Name string `json:"name"`
HTTP string `json:"http"`
// If manager http address is not specified, give it an address starting from this port. Optional.
// This is also used to auto-assign ports for test instances.
ManagerPort int `json:"manager_port_start"`
// If manager rpc address is not specified, give it addresses starting from this port. By default 30000.
// This is also used to auto-assign ports for test instances.
RPCPort int `json:"rpc_port_start"`
DashboardAddr string `json:"dashboard_addr"` // Optional.
DashboardClient string `json:"dashboard_client"` // Optional.
Expand Down Expand Up @@ -208,6 +210,10 @@ type ManagerConfig struct {
// By default it's 30 days.
MaxKernelLagDays int `json:"max_kernel_lag_days"`
managercfg *mgrconfig.Config

// Auto-assigned ports used by test instances.
testHTTPPort int
testRPCPort int
}

type ManagerJobs struct {
Expand Down Expand Up @@ -440,6 +446,10 @@ func loadManagerConfig(cfg *Config, mgr *ManagerConfig) error {
managercfg.RPC = fmt.Sprintf(":%v", cfg.RPCPort)
cfg.RPCPort++
}
mgr.testHTTPPort = cfg.ManagerPort
cfg.ManagerPort++
mgr.testRPCPort = cfg.RPCPort
cfg.RPCPort++
// Note: we don't change Compiler/Ccache because it may be just "gcc" referring
// to the system binary, or pkg/build/netbsd.go uses "g++" and "clang++" as special marks.
mgr.Userspace = osutil.Abs(mgr.Userspace)
Expand Down
Loading