diff mbox

[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 332: fix android support for fast models

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

Commit Message

Andy Doan June 25, 2012, 7:44 p.m. UTC
Merge authors:
  Andy Doan (doanac)
Related merge proposals:
  https://code.launchpad.net/~doanac/lava-dispatcher/fm-android-support-rev2/+merge/111638
  proposed by: Andy Doan (doanac)
  review: Approve - Michael Hudson-Doyle (mwhudson)
------------------------------------------------------------
revno: 332 [merge]
committer: Andy Doan <andy.doan@linaro.org>
branch nick: lava-dispatcher
timestamp: Mon 2012-06-25 14:43:14 -0500
message:
  fix android support for fast models
modified:
  lava_dispatcher/client/base.py
  lava_dispatcher/client/fastmodel.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-06-21 22:28:48 +0000
+++ lava_dispatcher/client/base.py	2012-06-25 19:42:56 +0000
@@ -182,18 +182,13 @@ 
         pexpect.run(cmd, timeout=300, logfile=sys.stdout)
 
     def get_default_nic_ip(self):
-        # XXX: IP could be assigned in other way in the validation farm
-        network_interface = self._client.default_network_interface
-        ip = None
+        network_interface = self._client.get_android_adb_interface()
         try:
             ip = self._get_default_nic_ip_by_ifconfig(network_interface)
         except:
             logging.exception("_get_default_nic_ip_by_ifconfig failed")
-            pass
+            return None
 
-        if ip is None:
-            self.get_ip_via_dhcp(network_interface)
-            ip = self._get_default_nic_ip_by_ifconfig(network_interface)
         return ip
 
     def _get_default_nic_ip_by_ifconfig(self, nic_name):
@@ -216,18 +211,11 @@ 
                 return match_group[0]
         return None
 
-    def get_ip_via_dhcp(self, nic):
-        try:
-            self.run('netcfg %s dhcp' % nic, timeout=60)
-        except:
-            logging.exception("netcfg %s dhcp failed" % nic)
-            raise NetworkError("netcfg %s dhcp exception" % nic)
-
     def wait_until_attached(self):
         for count in range(3):
             if self.check_device_state():
                 return
-            time.sleep(1)
+            time.sleep(3)
 
         raise NetworkError(
             "The android device(%s) isn't attached" % self._client.hostname)
@@ -314,6 +302,11 @@ 
     def lmc_dev_arg(self):
         return self.device_option("lmc_dev_arg")
 
+    @property
+    def enable_network_after_boot_android(self):
+        return self.config.getboolean(
+            'enable_network_after_boot_android', True)
+
     @contextlib.contextmanager
     def tester_session(self):
         """A session that can be used to run commands booted into the test
@@ -427,6 +420,9 @@ 
 
     # Android stuff
 
+    def get_android_adb_interface(self):
+        return self.default_network_interface
+
     def boot_linaro_android_image(self):
         """Reboot the system to the test android image."""
         self._boot_linaro_android_image()
@@ -436,14 +432,14 @@ 
         #TODO: set up proxy
 
         self._disable_suspend()
-        if self.config.get("enable_network_after_boot_android"):
+        if self.enable_network_after_boot_android:
             time.sleep(1)
             self._enable_network()
 
         self._enable_adb_over_tcpip()
 
     def _disable_suspend(self):
-        """ disable the suspend of images. 
+        """ disable the suspend of images.
         this needs wait unitl the home screen displayed"""
         session = AndroidTesterCommandRunner(self)
         try:
@@ -461,7 +457,8 @@ 
         session.run('sqlite3 /data/data/com.android.providers.settings/databases/settings.db "%s"' % (stay_awake)) ## set stay awake
         session.run('sqlite3 /data/data/com.android.providers.settings/databases/settings.db "%s"' % (screen_sleep)) ## set sleep to none
         session.run('sqlite3 /data/data/com.android.providers.settings/databases/settings.db "%s"' % (lockscreen)) ##set lock screen to none
-        session.run('input keyevent 82')  ##unlock the home screen
+        #unlock the home screen 240: for fastmodels, 120 failed, 180 failed some
+        session.run('input keyevent 82', timeout=240)
         session.run('service call power 1 i32 26') ##acquireWakeLock FULL_WAKE_LOCK
 
     def _enable_network(self):

=== modified file 'lava_dispatcher/client/fastmodel.py'
--- lava_dispatcher/client/fastmodel.py	2012-06-21 04:13:56 +0000
+++ lava_dispatcher/client/fastmodel.py	2012-06-22 16:18:50 +0000
@@ -60,16 +60,22 @@ 
         os.putenv('ARMLMD_LICENSE_FILE', lic_server)
         self._sim_proc = None
 
+    def get_android_adb_interface(self):
+        return 'lo'
+
     def _customize_android(self):
         with image_partition_mounted(self._sd_image, self.DATA_PARTITION) as d:
             wallpaper = '%s/%s' % (d, self.ANDROID_WALLPAPER)
             # delete the android active wallpaper as slows things down
             logging_system('sudo rm -f %s' % wallpaper)
 
-        #make sure PS1 is what we expect it to be
         with image_partition_mounted(self._sd_image, self.SYS_PARTITION) as d:
+            #make sure PS1 is what we expect it to be
             logging_system(
                 'sudo sh -c \'echo "PS1=%s ">> %s/etc/mkshrc\'' % (self.tester_str, d))
+            # fast model usermode networking does not support ping
+            logging_system(
+                'sudo sh -c \'echo "alias ping=\\\"echo LAVA-ping override 1 received\\\"">> %s/etc/mkshrc\'' %d)
 
     def _customize_ubuntu(self):
         with image_partition_mounted(self._sd_image, self.root_part) as mntdir:
@@ -97,7 +103,8 @@ 
             "-C motherboard.hostbridge.userNetworking=1 "
             "-C motherboard.mmc.p_mmc_file=%s "
             "-C coretile.cache_state_modelled=0 "
-            "-C coretile.cluster0.cpu0.semihosting-enable=1 ") % (
+            "-C coretile.cluster0.cpu0.semihosting-enable=1 "
+            "-C motherboard.hostbridge.userNetPorts='5555=5555'") % (
             self._sim_binary, self._axf, self._sd_image)
 
     def _boot_linaro_image(self):

=== modified file 'lava_dispatcher/config.py'
--- lava_dispatcher/config.py	2012-03-06 01:49:24 +0000
+++ lava_dispatcher/config.py	2012-06-25 19:42:56 +0000
@@ -89,6 +89,11 @@ 
     def getint(self, key):
         return self.cp.getint("DEFAULT", key)
 
+    def getboolean(self, key, default=True):
+        try:
+            return self.cp.getboolean("DEFAULT", key)
+        except ConfigParser.NoOptionError:
+            return default
 
 def get_config(name, config_dir):
     return ConfigWrapper(_get_config(name, config_dir), config_dir)