Merge lp:~liuyq0307/lava-dispatcher/disable-suspend-new into lp:lava-dispatcher

Proposed by Yongqin Liu
Status: Merged
Merged at revision: 196
Proposed branch: lp:~liuyq0307/lava-dispatcher/disable-suspend-new
Merge into: lp:lava-dispatcher
Diff against target: 77 lines (+23/-9)
2 files modified
lava_dispatcher/client/base.py (+22/-8)
lava_dispatcher/default-config/lava-dispatcher/device-types/panda.conf (+1/-1)
To merge this branch: bzr merge lp:~liuyq0307/lava-dispatcher/disable-suspend-new
Reviewer Review Type Date Requested Status
Yongqin Liu Approve
Zygmunt Krynicki (community) Abstain
Review via email: mp+88985@code.launchpad.net

Description of the change

add disable suspend process after android images booted up

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

29 + except:
30 + pass

Perhaps logging.exception("some text") would be sensible here

Otherwise the code looks good, cannot comment on the actual commands you use

review: Abstain
Revision history for this message
Paul Larson (pwlars) wrote :

> 29 + except:
> 30 + pass
>
> Perhaps logging.exception("some text") would be sensible here
In this case, logging on every pass could result in 100 log message spamming us at 5 sec. intervals. I *would* recommend just catching the error we are expecting to see if we're still waiting though, so that if anything unexpected happens, it results in something more verbose.

195. By Yongqin Liu

modify the timeout process for getprop init.svc.bootanim

Revision history for this message
Yongqin Liu (liuyq0307) wrote :

> > 29 + except:
> > 30 + pass
> >
> > Perhaps logging.exception("some text") would be sensible here
> In this case, logging on every pass could result in 100 log message spamming
> us at 5 sec. intervals. I *would* recommend just catching the error we are
> expecting to see if we're still waiting though, so that if anything unexpected
> happens, it results in something more verbose.

I changed the line like this:
self.run(cmd, response=['stopped', pexpect.TIMEOUT], timeout=5)

Revision history for this message
Yongqin Liu (liuyq0307) wrote :

Merge this branch first, confirm it with the mount-data-partition branch together.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lava_dispatcher/client/base.py'
2--- lava_dispatcher/client/base.py 2012-01-12 20:38:57 +0000
3+++ lava_dispatcher/client/base.py 2012-01-19 09:02:35 +0000
4@@ -59,7 +59,7 @@
5 index = 0
6 while index == 0:
7 index = self._connection.expect(
8- ['.+', pexpect.EOF, pexpect.TIMEOUT], timeout=1,lava_no_logging=1)
9+ ['.+', pexpect.EOF, pexpect.TIMEOUT], timeout=1, lava_no_logging=1)
10
11 def run(self, cmd, response=None, timeout=-1):
12 """Run `cmd` and wait for a shell response.
13@@ -126,7 +126,7 @@
14 def wait_network_up(self, timeout=300):
15 """Wait until the networking is working."""
16 now = time.time()
17- while time.time() < now+timeout:
18+ while time.time() < now + timeout:
19 if self._check_network_up():
20 return
21 raise NetworkError
22@@ -230,7 +230,7 @@
23 def wait_home_screen(self):
24 cmd = 'getprop init.svc.bootanim'
25 for count in range(100):
26- self.run(cmd, response='stopped', timeout=5)
27+ self.run(cmd, response=['stopped', pexpect.TIMEOUT], timeout=5)
28 if self.match_id == 0:
29 return True
30 time.sleep(1)
31@@ -403,16 +403,30 @@
32 if self.config.get("enable_network_after_boot_android"):
33 time.sleep(1)
34 self._enable_network()
35-
36+
37 self._enable_adb_over_tcpip()
38+ self._disable_suspend()
39+
40+ def _disable_suspend(self):
41+ """ disable the suspend of images.
42+ this needs wait unitl the home screen displayed"""
43+ session = AndroidTesterCommandRunner(self)
44+ session.wait_home_screen()
45+ stay_awake = "delete from system where name='stay_on_while_plugged_in'; insert into system (name, value) values ('stay_on_while_plugged_in','3');"
46+ screen_sleep = "delete from system where name='screen_off_timeout'; insert into system (name, value) values ('screen_off_timeout','-1');"
47+ lockscreen = "delete from secure where name='lockscreen.disabled'; insert into secure (name, value) values ('lockscreen.disabled','1');"
48+ session.run('sqlite3 /data/data/com.android.providers.settings/databases/settings.db "%s"' % (stay_awake)) ## set stay awake
49+ session.run('sqlite3 /data/data/com.android.providers.settings/databases/settings.db "%s"' % (screen_sleep)) ## set sleep to none
50+ session.run('sqlite3 /data/data/com.android.providers.settings/databases/settings.db "%s"' % (lockscreen)) ##set lock screen to none
51+ session.run('input keyevent 82') ##unlock the home screen
52+ session.run('service call power 1 i32 26') ##acquireWakeLock FULL_WAKE_LOCK
53
54 def _enable_network(self):
55- network_interface = self.default_network_interface
56 session = TesterCommandRunner(self, wait_for_rc=False)
57 session.run("netcfg", timeout=20)
58- session.run("netcfg %s up"%self.default_network_interface, timeout=20)
59- session.run("netcfg %s dhcp"%self.default_network_interface, timeout=300)
60- session.run("ifconfig " + self.default_network_interface, timeout=20)
61+ session.run("netcfg %s up" % self.default_network_interface, timeout=20)
62+ session.run("netcfg %s dhcp" % self.default_network_interface, timeout=300)
63+ session.run("ifconfig " + self.default_network_interface, timeout=20)
64
65
66 def _enable_adb_over_tcpip(self):
67
68=== modified file 'lava_dispatcher/default-config/lava-dispatcher/device-types/panda.conf'
69--- lava_dispatcher/default-config/lava-dispatcher/device-types/panda.conf 2011-09-19 10:17:10 +0000
70+++ lava_dispatcher/default-config/lava-dispatcher/device-types/panda.conf 2012-01-19 09:02:35 +0000
71@@ -14,5 +14,5 @@
72 setenv bootargs "'console=tty0 console=ttyO2,115200n8
73 rootwait rw earlyprintk fixrtc nocompcache vram=48M
74 omapfb.vram=0:24M,1:24M mem=456M@0x80000000 mem=512M@0xA0000000
75- init=/init androidboot.console=ttyO2'",
76+ init=/init androidboot.console=ttyO2 no_console_suspend'",
77 boot

Subscribers

People subscribed via source and target branches