diff mbox

[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 347: merge with the branch that changing to use the disablesuspend.sh in android

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

Commit Message

Yongqin Liu July 12, 2012, 2:27 a.m. UTC
Merge authors:
  Yongqin Liu (liuyq0307)
Related merge proposals:
  https://code.launchpad.net/~liuyq0307/lava-dispatcher/use-disablesuspend-sh/+merge/114087
  proposed by: Yongqin Liu (liuyq0307)
  review: Approve - Yongqin Liu (liuyq0307)
------------------------------------------------------------
revno: 347 [merge]
committer: Yongqin Liu <yongqin.liu@linaro.org>
branch nick: lava-dispatcher
timestamp: Thu 2012-07-12 10:25:57 +0800
message:
  merge with the branch that changing to use the disablesuspend.sh in android
modified:
  lava_dispatcher/client/base.py
  lava_dispatcher/client/fastmodel.py
  lava_dispatcher/client/master.py
  lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf
  lava_dispatcher/default-config/lava-dispatcher/device-types/fastmodel.conf


--
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-27 09:13:53 +0000
+++ lava_dispatcher/client/base.py	2012-07-04 03:38:44 +0000
@@ -457,15 +457,7 @@ 
             else:
                 logging.info("Skip raising exception on the home screen has not displayed for health check jobs")
 
-        stay_awake = "delete from system where name='stay_on_while_plugged_in'; insert into system (name, value) values ('stay_on_while_plugged_in','3');"
-        screen_sleep = "delete from system where name='screen_off_timeout'; insert into system (name, value) values ('screen_off_timeout','-1');"
-        lockscreen = "delete from secure where name='lockscreen.disabled'; insert into secure (name, value) values ('lockscreen.disabled','1');"
-        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
-        #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
+        session.run('/system/bin/disablesuspend.sh')
 
     def _enable_network(self):
         session = TesterCommandRunner(self, wait_for_rc=False)

=== modified file 'lava_dispatcher/client/fastmodel.py'
--- lava_dispatcher/client/fastmodel.py	2012-07-09 23:11:59 +0000
+++ lava_dispatcher/client/fastmodel.py	2012-07-12 02:25:57 +0000
@@ -49,13 +49,15 @@ 
 
     PORT_PATTERN = 'terminal_0: Listening for serial connection on port (\d+)'
     ANDROID_WALLPAPER = 'system/wallpaper_info.xml'
-    SYS_PARTITION  = 2
+    SYS_PARTITION = 2
     DATA_PARTITION = 5
 
     def __init__(self, context, config):
         super(LavaFastModelClient, self).__init__(context, config)
         self._sim_binary = config.get('simulator_binary', None)
         lic_server = config.get('license_server', None)
+        self.git_url_disablesuspend_sh = config.get('git_url_disablesuspend_sh',
+                                                    None)
         if not self._sim_binary or not lic_server:
             raise RuntimeError("The device type config for this device "
                 "requires settings for 'simulator_binary' and 'license_server'")
@@ -73,12 +75,20 @@ 
             logging_system('sudo rm -f %s' % wallpaper)
 
         with image_partition_mounted(self._sd_image, self.SYS_PARTITION) as d:
+            script_path = '%s/%s' % (d, '/system/bin/disablesuspend.sh')
+            if self.git_url_disablesuspend_sh:
+                logging_system('sudo wget %s -O %s' % (
+                                               self.git_url_disablesuspend_sh,
+                                               script_path))
+                logging_system('sudo chmod +x %s' % script_path)
+                logging_system('sudo chown :2000 %s' % script_path)
+
             #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)
+                '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:
@@ -111,7 +121,7 @@ 
         with image_partition_mounted(self._sd_image, self.boot_part) as mntdir:
             src = '%s/linux-system-ISW.axf' % mntdir
             self._axf = \
-                '%s/%s' % (os.path.dirname(self._system),os.path.split(src)[1])
+                '%s/%s' % (os.path.dirname(self._system), os.path.split(src)[1])
             shutil.copyfile(src, self._axf)
 
         self._customize_android()

=== modified file 'lava_dispatcher/client/master.py'
--- lava_dispatcher/client/master.py	2012-07-06 01:47:32 +0000
+++ lava_dispatcher/client/master.py	2012-07-10 02:23:04 +0000
@@ -220,7 +220,8 @@ 
     _deploy_tarball_to_board(session, systemtbz2, '/mnt/lava', timeout=600)
 
     if session.has_partition_with_label('userdata') and \
-       session.has_partition_with_label('sdcard'):
+       session.has_partition_with_label('sdcard') and \:
+       session.is_file_exist('/mnt/lava/system/etc/vold.fstab'):
         # If there is no userdata partition on the sdcard(like iMX and Origen),
         # then the sdcard partition will be used as the userdata partition as
         # before, and so cannot be used here as the sdcard on android
@@ -229,12 +230,25 @@ 
                    "/mnt/sdcard %s /devices/platform/omap/omap_hsmmc.0/"
                    "mmc_host/mmc0") % sdcard_part_lava
         session.run(
-            'sed -i "%s" /mnt/lava/system/etc/vold.fstab' % sed_cmd)
+            'sed -i "%s" /mnt/lava/system/etc/vold.fstab' % sed_cmd,
+            failok=True)
+
+    script_path = '%s/%s' % ('/mnt/lava', '/system/bin/disablesuspend.sh')
+    if not session.is_file_exist(script_path):
+        git_url = session._client.device_option("git_url_disablesuspend_sh")
+        lava_proxy = session._client.context.lava_proxy
+        session.run("sh -c 'export http_proxy=%s'" % lava_proxy)
+        session.run('wget %s -O %s' % (git_url, script_path))
+        session.run('chmod +x %s' % script_path)
+        session.run('chown :2000 %s' % script_path)
+
     session.run(
         'sed -i "s/^PS1=.*$/PS1=\'root@linaro: \'/" /mnt/lava/system/etc/mkshrc',
         failok=True)
+
     session.run('umount /mnt/lava/system')
 
+
 def _purge_linaro_android_sdcard(session):
     logging.info("Reformatting Linaro Android sdcard filesystem")
     session.run('mkfs.vfat /dev/disk/by-label/sdcard -n sdcard')
@@ -305,8 +319,12 @@ 
         if not label:
             return False
 
-        cmd = 'ls /dev/disk/by-label/%s' % label
-        rc = self.run(cmd, timeout=2, failok=True)
+        path = '/dev/disk/by-label/%s' % label
+        return self.is_file_exist(path)
+
+    def is_file_exist(self, path):
+        cmd = 'ls %s' % path
+        rc = self.run(cmd, failok=True)
         if rc == 0:
             return True
         return False

=== modified file 'lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf'
--- lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf	2012-07-02 07:01:52 +0000
+++ lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf	2012-07-07 05:37:29 +0000
@@ -113,3 +113,6 @@ 
 # This is for android build where the network is not up by default. 1 or 0
 enable_network_after_boot_android = 1
 
+# the url of disablesusepend.sh script in android git repository
+git_url_disablesuspend_sh = "http://android.git.linaro.org/gitweb?p=device/linaro/common.git;a=blob_plain;f=disablesuspend.sh;hb=refs/heads/linaro-ics"
+

=== modified file 'lava_dispatcher/default-config/lava-dispatcher/device-types/fastmodel.conf'
--- lava_dispatcher/default-config/lava-dispatcher/device-types/fastmodel.conf	2012-06-15 20:37:40 +0000
+++ lava_dispatcher/default-config/lava-dispatcher/device-types/fastmodel.conf	2012-07-10 02:42:13 +0000
@@ -3,3 +3,6 @@ 
 
 # The license server must also be specified. eg:
 #license_server = 8224@192.168.1.10
+
+# the url of disablesusepend.sh script in android git repository
+git_url_disablesuspend_sh = "http://android.git.linaro.org/gitweb?p=device/linaro/common.git;a=blob_plain;f=disablesuspend.sh;hb=refs/heads/linaro-ics"