diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2017-06-27 10:28:22 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-06-27 10:28:22 +0200 |
| commit | 274bfdcec9b3acca02438362cefac2b94d6b9856 (patch) | |
| tree | c9f842766ae13fd2e1f0f5179f08f4d90d85e827 /vm | |
| parent | 7cacd94aa6b454ba098e7dafe2ca82c1f28bd239 (diff) | |
vm/adb: add an option to disable battery check
Add a new VM option:
// Ensure that a device battery level is at 20+% before fuzzing.
// Sometimes we observe that a device can't charge during heavy fuzzing
// and eventually powers down (which then requires manual intervention).
// This option is enabled by default. Turn it off if your devices
// don't have battery service, or it causes problems otherwise.
Battery_Check bool
Fixes #258
Diffstat (limited to 'vm')
| -rw-r--r-- | vm/adb/adb.go | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/vm/adb/adb.go b/vm/adb/adb.go index 0daad7fd6..fb9cd93bd 100644 --- a/vm/adb/adb.go +++ b/vm/adb/adb.go @@ -30,6 +30,13 @@ func init() { type Config struct { Adb string // adb binary name ("adb" by default) Devices []string // list of adb device IDs to use + + // Ensure that a device battery level is at 20+% before fuzzing. + // Sometimes we observe that a device can't charge during heavy fuzzing + // and eventually powers down (which then requires manual intervention). + // This option is enabled by default. Turn it off if your devices + // don't have battery service, or it causes problems otherwise. + Battery_Check bool } type Pool struct { @@ -47,7 +54,8 @@ type instance struct { func ctor(env *vmimpl.Env) (vmimpl.Pool, error) { cfg := &Config{ - Adb: "adb", + Adb: "adb", + Battery_Check: true, } if err := config.LoadData(env.Config, cfg); err != nil { return nil, fmt.Errorf("failed to parse adb vm config: %v", err) @@ -95,8 +103,10 @@ func (pool *Pool) Create(workdir string, index int) (vmimpl.Instance, error) { return nil, err } inst.console = findConsole(inst.adbBin, inst.device) - if err := inst.checkBatteryLevel(); err != nil { - return nil, err + if pool.cfg.Battery_Check { + if err := inst.checkBatteryLevel(); err != nil { + return nil, err + } } // Remove temp files from previous runs. if _, err := inst.adb("shell", "rm -Rf /data/syzkaller*"); err != nil { |
