aboutsummaryrefslogtreecommitdiffstats
path: root/vm
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2016-09-29 15:27:13 +0200
committerDmitry Vyukov <dvyukov@google.com>2016-09-29 15:27:13 +0200
commite73ddfcb3ac418fc690b982f70da15b898096fa5 (patch)
treeb43de81713a5f00642b9384a391fd7e66794b42b /vm
parent93b629129799c4fd3fb520929f30a9d4f444156b (diff)
vm/adb: reboot devices in the beginning of each cycle
Issue #70 reports that a device can be permanently OOM, if we don't reboot it new fuzzers will be always killed. And it's generally safer to assume that a device is in some bad shape initially. So always reboot them on start. Fixes #70
Diffstat (limited to 'vm')
-rw-r--r--vm/adb/adb.go14
1 files changed, 5 insertions, 9 deletions
diff --git a/vm/adb/adb.go b/vm/adb/adb.go
index f079fb448..c428df3a3 100644
--- a/vm/adb/adb.go
+++ b/vm/adb/adb.go
@@ -157,19 +157,15 @@ func (inst *instance) adb(args ...string) ([]byte, error) {
}
func (inst *instance) repair() error {
- // Give the device up to 5 minutes to come up (it can be rebooting after a previous crash).
- if !vm.SleepInterruptible(3 * time.Second) {
- return fmt.Errorf("shutdown in progress")
- }
+ // Assume that the device is in a bad state initially and reboot it.
for i := 0; i < 300; i++ {
+ if _, err := inst.adb("shell", "pwd"); err == nil {
+ break
+ }
if !vm.SleepInterruptible(time.Second) {
return fmt.Errorf("shutdown in progress")
}
- if _, err := inst.adb("shell", "pwd"); err == nil {
- return nil
- }
}
- // If it does not help, reboot.
// adb reboot episodically hangs, so we use a more reliable way.
// Ignore errors because all other adb commands hang as well
// and the binary can already be on the device.
@@ -177,7 +173,7 @@ func (inst *instance) repair() error {
if _, err := inst.adb("shell", "/data/syz-executor", "reboot"); err != nil {
return err
}
- // Now give it another 5 minutes.
+ // Now give it another 5 minutes to boot.
if !vm.SleepInterruptible(10 * time.Second) {
return fmt.Errorf("shutdown in progress")
}