diff mbox

[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 197: deploy data partition in android

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

Commit Message

Paul Larson Jan. 19, 2012, 5:16 p.m. UTC
Merge authors:
  Yongqin Liu (liuyq0307)
Related merge proposals:
  https://code.launchpad.net/~liuyq0307/lava-dispatcher/mount-data-partition/+merge/89050
  proposed by: Yongqin Liu (liuyq0307)
  review: Approve - Le Chi Thu (le-chi-thu)
------------------------------------------------------------
revno: 197 [merge]
committer: Paul Larson <paul.larson@linaro.org>
branch nick: lava-dispatcher
timestamp: Thu 2012-01-19 11:14:19 -0600
message:
  deploy data partition in android
modified:
  lava_dispatcher/client/base.py
  lava_dispatcher/client/master.py
  lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf
  lava_dispatcher/default-config/lava-dispatcher/device-types/panda.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-01-19 08:59:29 +0000
+++ lava_dispatcher/client/base.py	2012-01-19 11:16:49 +0000
@@ -339,6 +339,15 @@ 
         dev_ip = session.get_default_nic_ip()
         if dev_ip is None:
             raise OperationFailed("failed to get board ip address")
+        try:
+            ## just disconnect the adb connection in case is remained
+            ## by last action or last job
+            ## that connection should be expired already
+            session.android_adb_disconnect(dev_ip)
+        except:
+            ## ignore all exception
+            ## this just in case of exception
+            pass
         session.android_adb_connect(dev_ip)
         session.wait_until_attached()
         session.wait_home_screen()

=== modified file 'lava_dispatcher/client/master.py'
--- lava_dispatcher/client/master.py	2012-01-15 23:37:30 +0000
+++ lava_dispatcher/client/master.py	2012-01-19 09:40:30 +0000
@@ -128,6 +128,7 @@ 
     data_part_org = session._client.device_option("data_part_android_org")
     # Sdcard layout in Lava image
     sys_part_lava = session._client.device_option("sys_part_android")
+    data_part_lava = session._client.device_option("data_part_android")
 
     session.run('mkdir -p ~/tmp/')
     session.run('mv /mnt/lava/boot/uInitrd ~/tmp')
@@ -140,12 +141,16 @@ 
     session.run(
         'sed -i "/mount ext4 \/dev\/block\/mmcblk0p%s/d" init.rc'
         % cache_part_org)
-    session.run(
-        'sed -i "/mount ext4 \/dev\/block\/mmcblk0p%s/d" init.rc'
-        % data_part_org)
+#    session.run(
+#        'sed -i "/mount ext4 \/dev\/block\/mmcblk0p%s/d" init.rc'
+#        % data_part_org)
+    session.run('sed -i "s/mmcblk0p%s/mmcblk0p%s/g" init.rc'
+        % (data_part_org, data_part_lava))
     session.run('sed -i "s/mmcblk0p%s/mmcblk0p%s/g" init.rc'
         % (sys_part_org, sys_part_lava))
-	# for snowball the mcvblk1 is used instead of mmcblk0.
+    # for snowball the mcvblk1 is used instead of mmcblk0.
+    session.run('sed -i "s/mmcblk1p%s/mmcblk1p%s/g" init.rc'
+        % (data_part_org, data_part_lava))
     session.run('sed -i "s/mmcblk1p%s/mmcblk1p%s/g" init.rc'
         % (sys_part_org, sys_part_lava))
     session.run(
@@ -167,7 +172,7 @@ 
 
 def _deploy_linaro_android_testrootfs(session, systemtbz2, rootfstype):
     logging.info("Deploying the test root filesystem")
-    sdcard_part_lava = session._client.device_option("sdcard_part_android")
+#    sdcard_part_lava = session._client.device_option("sdcard_part_android")
 
     session.run('umount /dev/disk/by-label/testrootfs')
     session.run(
@@ -178,10 +183,10 @@ 
         'mount /dev/disk/by-label/testrootfs /mnt/lava/system')
     _deploy_tarball_to_board(session, systemtbz2, '/mnt/lava', timeout=600)
 
-    sed_cmd = "/dev_mount sdcard \/mnt\/sdcard/c dev_mount sdcard /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_cmd = "/dev_mount sdcard \/mnt\/sdcard/c dev_mount sdcard /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)
     session.run('sed -i "s/^PS1=.*$/PS1=\'root@linaro: \'/" /mnt/lava/system/etc/mkshrc')
     session.run('umount /mnt/lava/system')
 
@@ -190,6 +195,15 @@ 
     session.run('mkfs.vfat /dev/disk/by-label/sdcard -n sdcard')
     session.run('udevadm trigger')
 
+def _deploy_linaro_android_data(session, datatbz2):
+    ##consider the compatiblity, here use the existed sdcard partition
+    data_label = 'sdcard'
+    session.run('mkfs.ext4 -q /dev/disk/by-label/%s -L %s' % (data_label, data_label))
+    session.run('udevadm trigger')
+    session.run('mkdir -p /mnt/lava/data')
+    session.run('mount /dev/disk/by-label/%s /mnt/lava/data' % (data_label))
+    _deploy_tarball_to_board(session, datatbz2, '/mnt/lava', timeout=600)
+    session.run('umount /mnt/lava/data')
 
 class PrefixCommandRunner(CommandRunner):
     """A CommandRunner that prefixes every command run with a given string.
@@ -317,14 +331,15 @@ 
 
                 boot_tarball = boot_tbz2.replace(LAVA_IMAGE_TMPDIR, '')
                 system_tarball = system_tbz2.replace(LAVA_IMAGE_TMPDIR, '')
-                #data_tarball = data_tbz2.replace(LAVA_IMAGE_TMPDIR, '')
+                data_tarball = data_tbz2.replace(LAVA_IMAGE_TMPDIR, '')
 
                 boot_url = '/'.join(u.strip('/') for u in [
                     LAVA_IMAGE_URL, boot_tarball])
                 system_url = '/'.join(u.strip('/') for u in [
                     LAVA_IMAGE_URL, system_tarball])
-                #data_url = '/'.join(u.strip('/') for u in [
-                #    LAVA_IMAGE_URL, data_tarball])
+                data_url = '/'.join(u.strip('/') for u in [
+                    LAVA_IMAGE_URL, data_tarball])
+
                 if pkg_tbz2:
                     pkg_tarball = pkg_tbz2.replace(LAVA_IMAGE_TMPDIR, '')
                     pkg_url = '/'.join(u.strip('/') for u in [
@@ -335,7 +350,8 @@ 
                 try:
                     _deploy_linaro_android_testboot(session, boot_url, pkg_url)
                     _deploy_linaro_android_testrootfs(session, system_url, rootfstype)
-                    _purge_linaro_android_sdcard(session)
+#                    _purge_linaro_android_sdcard(session)
+                    _deploy_linaro_android_data(session, data_url)
                 except:
                     tb = traceback.format_exc()
                     self.sio.write(tb)

=== modified file 'lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf'
--- lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf	2012-01-18 00:13:44 +0000
+++ lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf	2012-01-18 16:46:35 +0000
@@ -71,7 +71,10 @@ 
 # sys partition number in LAVA test image, counting from 1
 sys_part_android = 5
 # sdcard partition number in LAVA test image, counting from 1
-sdcard_part_android = 6
+#sdcard_part_android = 6
+
+# data partition number in LAVA test image, counting from 1
+data_part_android = 6
 
 # Master image recognization string
 MASTER_STR = root@master

=== modified file 'lava_dispatcher/default-config/lava-dispatcher/device-types/panda.conf'
--- lava_dispatcher/default-config/lava-dispatcher/device-types/panda.conf	2012-01-18 07:41:42 +0000
+++ lava_dispatcher/default-config/lava-dispatcher/device-types/panda.conf	2012-01-18 17:12:47 +0000
@@ -14,5 +14,5 @@ 
     setenv bootargs "'console=tty0 console=ttyO2,115200n8 
     rootwait rw earlyprintk fixrtc nocompcache vram=48M 
     omapfb.vram=0:24M,1:24M mem=456M@0x80000000 mem=512M@0xA0000000 
-    init=/init androidboot.console=ttyO2 no_console_suspend'",
+    init=/init androidboot.console=ttyO2'",
     boot