aboutsummaryrefslogtreecommitdiffstats
path: root/vm/vmware
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2024-06-28 15:48:43 +0200
committerAleksandr Nogikh <nogikh@google.com>2024-07-01 09:13:47 +0000
commit714041c90b9b0efe7fb63d39fa6b0aa643f2450c (patch)
tree7f808952cf73868d27cd06ce59ef0a3b5818425d /vm/vmware
parenta7b22031cdbe8555ef6d4a086bd11dbc9feea4fd (diff)
vm: refactor vm.Multiplex arguments
Introduce a MultiplexConfig structure that contains optional parameters. Include a Scale parameter to control the intended slowdown.
Diffstat (limited to 'vm/vmware')
-rw-r--r--vm/vmware/vmware.go25
1 files changed, 17 insertions, 8 deletions
diff --git a/vm/vmware/vmware.go b/vm/vmware/vmware.go
index 4c05bac12..f2b3431c0 100644
--- a/vm/vmware/vmware.go
+++ b/vm/vmware/vmware.go
@@ -18,6 +18,7 @@ import (
"github.com/google/syzkaller/pkg/log"
"github.com/google/syzkaller/pkg/osutil"
"github.com/google/syzkaller/pkg/report"
+ "github.com/google/syzkaller/sys/targets"
"github.com/google/syzkaller/vm/vmimpl"
)
@@ -45,6 +46,7 @@ type instance struct {
sshuser string
sshkey string
forwardPort int
+ timeouts targets.Timeouts
}
func ctor(env *vmimpl.Env) (vmimpl.Pool, error) {
@@ -82,13 +84,14 @@ func (pool *Pool) Create(workdir string, index int) (vmimpl.Instance, error) {
sshkey := pool.env.SSHKey
sshuser := pool.env.SSHUser
inst := &instance{
- cfg: pool.cfg,
- debug: pool.env.Debug,
- baseVMX: pool.cfg.BaseVMX,
- vmx: vmx,
- sshkey: sshkey,
- sshuser: sshuser,
- closed: make(chan bool),
+ cfg: pool.cfg,
+ debug: pool.env.Debug,
+ baseVMX: pool.cfg.BaseVMX,
+ vmx: vmx,
+ sshkey: sshkey,
+ sshuser: sshuser,
+ closed: make(chan bool),
+ timeouts: pool.env.Timeouts,
}
if err := inst.clone(); err != nil {
return nil, err
@@ -215,7 +218,13 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin
merger.Add("dmesg", dmesg)
merger.Add("ssh", rpipe)
- return vmimpl.Multiplex(cmd, merger, dmesg, timeout, stop, inst.closed, inst.debug)
+ return vmimpl.Multiplex(cmd, merger, timeout, vmimpl.MultiplexConfig{
+ Console: dmesg,
+ Stop: stop,
+ Close: inst.closed,
+ Debug: inst.debug,
+ Scale: inst.timeouts.Scale,
+ })
}
func (inst *instance) Diagnose(rep *report.Report) ([]byte, bool) {