diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2024-06-28 15:48:43 +0200 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2024-07-01 09:13:47 +0000 |
| commit | 714041c90b9b0efe7fb63d39fa6b0aa643f2450c (patch) | |
| tree | 7f808952cf73868d27cd06ce59ef0a3b5818425d /vm/adb | |
| parent | a7b22031cdbe8555ef6d4a086bd11dbc9feea4fd (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/adb')
| -rw-r--r-- | vm/adb/adb.go | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/vm/adb/adb.go b/vm/adb/adb.go index ed9fa56b7..ad0347342 100644 --- a/vm/adb/adb.go +++ b/vm/adb/adb.go @@ -22,6 +22,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" ) @@ -57,12 +58,13 @@ type Pool struct { } type instance struct { - cfg *Config - adbBin string - device string - console string - closed chan bool - debug bool + cfg *Config + adbBin string + device string + console string + closed chan bool + debug bool + timeouts targets.Timeouts } var ( @@ -131,12 +133,13 @@ func (pool *Pool) Create(workdir string, index int) (vmimpl.Instance, error) { return nil, err } inst := &instance{ - cfg: pool.cfg, - adbBin: pool.cfg.Adb, - device: device.Serial, - console: device.Console, - closed: make(chan bool), - debug: pool.env.Debug, + cfg: pool.cfg, + adbBin: pool.cfg.Adb, + device: device.Serial, + console: device.Console, + closed: make(chan bool), + debug: pool.env.Debug, + timeouts: pool.env.Timeouts, } closeInst := inst defer func() { @@ -552,7 +555,13 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin merger.Add("console", tty) merger.Add("adb", adbRpipe) - return vmimpl.Multiplex(adb, merger, tty, timeout, stop, inst.closed, inst.debug) + return vmimpl.Multiplex(adb, merger, timeout, vmimpl.MultiplexConfig{ + Console: tty, + Stop: stop, + Close: inst.closed, + Debug: inst.debug, + Scale: inst.timeouts.Scale, + }) } func (inst *instance) Diagnose(rep *report.Report) ([]byte, bool) { |
