diff mbox

[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 487: small refactoring on Android handling code

Message ID 20121205145015.32515.67580.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Antonio Terceiro Dec. 5, 2012, 2:50 p.m. UTC
------------------------------------------------------------
revno: 487
committer: Antonio Terceiro <antonio.terceiro@linaro.org>
branch nick: trunk
timestamp: Wed 2012-12-05 11:47:46 -0300
message:
  small refactoring on Android handling code
  
  cherry-picked from lp:~terceiro/lava-dispatcher/nexus
modified:
  lava_dispatcher/client/base.py
  lava_dispatcher/config.py


--
lp:lava-dispatcher
https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk

You are subscribed to branch lp:lava-dispatcher.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava_dispatcher/client/base.py'
--- lava_dispatcher/client/base.py	2012-11-29 08:54:47 +0000
+++ lava_dispatcher/client/base.py	2012-12-05 14:47:46 +0000
@@ -254,6 +254,7 @@ 
     def wait_home_screen(self):
         cmd = 'getprop init.svc.bootanim'
         for count in range(100):
+            logging.debug("Waiting for home screen (%d/100)" % count)
             try:
                 self.run(cmd, response=['stopped'], timeout=5)
                 if self.match_id == 0:
@@ -272,9 +273,6 @@ 
                 return True
         return False
 
-    def retrieve_results(self, result_disk):
-        raise NotImplementedError(self.retrieve_results)
-
 
 class LavaClient(object):
     """
@@ -411,6 +409,9 @@ 
         '''returns attachments to go in the "lava_results" test run'''
         return [ create_attachment('serial.log', self.sio.getvalue()) ]
 
+    def retrieve_results(self, result_disk):
+        raise NotImplementedError(self.retrieve_results)
+
     # Android stuff
 
     def get_android_adb_interface(self):
@@ -426,15 +427,18 @@ 
             raise OperationFailed("booting into android test image failed")
         #TODO: set up proxy
 
-        # we are tcp'ish adb fans here...
-        self._disable_adb_over_usb()
-
-        self._disable_suspend()
+        if not self.config.android_adb_over_usb:
+            self._disable_adb_over_usb()
+
+        if self.config.android_disable_suspend:
+            self._disable_suspend()
+
         if self.config.enable_network_after_boot_android:
             time.sleep(1)
             self._enable_network()
 
-        self._restart_adb_after_netup()
+        if self.config.android_adb_over_tcp:
+            self._enable_adb_over_tcp()
 
 
     def _disable_suspend(self):
@@ -462,8 +466,8 @@ 
         session.run("ifconfig " + self.config.default_network_interface, timeout=20)
 
 
-    def _restart_adb_after_netup(self):
-        logging.info("Restart adb after netup")
+    def _enable_adb_over_tcp(self):
+        logging.info("Enabling ADB over TCP")
         session = AndroidTesterCommandRunner(self)
         session.run('setprop service.adb.tcp.port 5555')
         session.run('stop adbd')

=== modified file 'lava_dispatcher/config.py'
--- lava_dispatcher/config.py	2012-12-02 17:40:55 +0000
+++ lava_dispatcher/config.py	2012-12-05 14:47:46 +0000
@@ -74,6 +74,10 @@ 
     simulator_command = schema.StringOption()
     simulator_axf_files = schema.ListOption()
 
+    android_disable_suspend = schema.BoolOption(default = True)
+    android_adb_over_usb = schema.BoolOption(default = False)
+    android_adb_over_tcp = schema.BoolOption(default = True)
+
 
 class OptionDescriptor(object):
     def __init__(self, name):