From patchwork Mon Jul 2 02:27:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongqin Liu X-Patchwork-Id: 9722 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 412A423E47 for ; Mon, 2 Jul 2012 02:27:15 +0000 (UTC) Received: from mail-yw0-f47.google.com (mail-yw0-f47.google.com [209.85.213.47]) by fiordland.canonical.com (Postfix) with ESMTP id E1EFBA18700 for ; Mon, 2 Jul 2012 02:27:14 +0000 (UTC) Received: by yhjj56 with SMTP id j56so4722970yhj.20 for ; Sun, 01 Jul 2012 19:27:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :content-type:mime-version:x-launchpad-project:x-launchpad-branch :x-launchpad-message-rationale:x-launchpad-branch-revision-number :x-launchpad-notification-type:to:from:subject:message-id:date :reply-to:sender:errors-to:precedence:x-generated-by :x-launchpad-hash:x-gm-message-state; bh=dYVru+GS3qyv2H5NWRHPRds80Az7tGq7dsSyaGuWnjA=; b=Bbq35hDg1NGAkFmuHnG1iZg7/oajIaiifxwcHw6YboU1NCFdqPGcjryOo/UibeYqP2 cruU+F5JEvIu5V7cK5x3kL7KEPDKUnVwvPMz+arXtxaIotW9rh0SPkMfve6UTzQyl8QX a0z0G0LxZ6J3DfBrniVEO2Nhg6ml09tK67Pn8mdvrYeZK8fSV+LEyqzcV/wXHQsFjKDF 6JuOKX3ENwBRpsHADj3lFg1c3viiQsvivLbCsZfCLLjYsCjTpGKHX8vO4wZSNNc8DHwX PrDAB18WjZx7HWz8HwPnvP2IzVsutUWuws+kF9IRbkqzi8NlMkdLmMiC5nFPZwq0ftb7 GlDw== Received: by 10.42.210.193 with SMTP id gl1mr5109770icb.57.1341196034202; Sun, 01 Jul 2012 19:27:14 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp16164ibb; Sun, 1 Jul 2012 19:27:13 -0700 (PDT) Received: by 10.180.80.35 with SMTP id o3mr13252083wix.7.1341196032118; Sun, 01 Jul 2012 19:27:12 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id n59si10238739wel.67.2012.07.01.19.27.11 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 01 Jul 2012 19:27:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1SlWM2-0003Vj-V5 for ; Mon, 02 Jul 2012 02:27:10 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id DD61AE0020 for ; Mon, 2 Jul 2012 02:27:10 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-dispatcher X-Launchpad-Branch: ~linaro-validation/lava-dispatcher/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 342 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 342: merge with the branch that support sdcard partition Message-Id: <20120702022710.9295.60108.launchpad@ackee.canonical.com> Date: Mon, 02 Jul 2012 02:27:10 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="15520"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 9191df1d2b097204ea407fb9e945ab8d61c648c1 X-Gm-Message-State: ALoCoQlOVdPdoqJCuGRSZsXlP2f0fw5Pf2zX5rydIr65HHs6kmOTeHAC5m2y1sSYqvvE4GJ3dc+W Merge authors: Yongqin Liu (liuyq0307) Related merge proposals: https://code.launchpad.net/~liuyq0307/lava-dispatcher/add-sdcard/+merge/112736 proposed by: Yongqin Liu (liuyq0307) review: Approve - Michael Hudson-Doyle (mwhudson) review: Approve - Andy Doan (doanac) ------------------------------------------------------------ revno: 342 [merge] committer: Yongqin Liu branch nick: lava-dispatcher timestamp: Mon 2012-07-02 10:25:41 +0800 message: merge with the branch that support sdcard partition modified: lava_dispatcher/client/master.py lava_dispatcher/default-config/lava-dispatcher/device-defaults.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 === modified file 'lava_dispatcher/client/master.py' --- lava_dispatcher/client/master.py 2012-06-28 07:59:26 +0000 +++ lava_dispatcher/client/master.py 2012-07-02 02:25:41 +0000 @@ -69,7 +69,7 @@ if rc: raise RuntimeError("Failed to create tarball: %s" % tarfile) -WGET_DEBUGGING_OPTIONS='-S --progress=dot -e dotbytes=2M' +WGET_DEBUGGING_OPTIONS = '-S --progress=dot -e dotbytes=2M' def _deploy_tarball_to_board(session, tarball_url, dest, timeout=-1, num_retry=5): decompression_char = '' @@ -88,7 +88,7 @@ % (WGET_DEBUGGING_OPTIONS, tarball_url, dest, decompression_char), timeout=timeout) except (OperationFailed, pexpect.TIMEOUT): - logging.warning("Deploy %s failed. %d retry left." %(tarball_url, num_retry-1)) + logging.warning("Deploy %s failed. %d retry left." % (tarball_url, num_retry - 1)) else: deploy_ok = True break @@ -96,7 +96,7 @@ if num_retry > 1: # send CTRL C in case wget still hasn't exited. session._client.proc.sendcontrol("c") - session._client.proc.sendline("echo 'retry left %s time(s)'" % (num_retry-1)) + session._client.proc.sendline("echo 'retry left %s time(s)'" % (num_retry - 1)) # And wait a little while. sleep_time = 60 logging.info("Wait %d second before retry" % sleep_time) @@ -209,7 +209,6 @@ 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") session.run('umount /dev/disk/by-label/testrootfs', failok=True) session.run( @@ -220,10 +219,17 @@ '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) + if session.has_partition_with_label('userdata') and \ + session.has_partition_with_label('sdcard'): + # 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 + sdcard_part_lava = session._client.device_option("sdcard_part_android") + 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', failok=True) @@ -235,8 +241,12 @@ session.run('udevadm trigger') def _deploy_linaro_android_data(session, datatbz2): - ##consider the compatiblity, here use the existed sdcard partition - data_label = 'sdcard' + + data_label = 'userdata' + if not session.has_partition_with_label(data_label): + ##consider the compatiblity, here use the existed sdcard partition + data_label = 'sdcard' + session.run('umount /dev/disk/by-label/%s' % data_label, failok=True) session.run('mkfs.ext4 -q /dev/disk/by-label/%s -L %s' % (data_label, data_label)) session.run('udevadm trigger') @@ -291,6 +301,16 @@ return ip return None + def has_partition_with_label(self, label): + if not label: + return False + + cmd = 'ls /dev/disk/by-label/%s' % label + rc = self.run(cmd, timeout=2, failok=True) + if rc == 0: + return True + return False + class LavaMasterImageClient(LavaClient): @@ -327,7 +347,7 @@ proc = logging_spawn(cmd, timeout=1200) proc.logfile_read = self.sio #serial can be slow, races do funny things if you don't increase delay - proc.delaybeforesend=1 + proc.delaybeforesend = 1 logging.info('Attempting to connect to device') match = proc.expect(patterns, timeout=10) result = results[match] @@ -360,7 +380,7 @@ def _tarball_url_to_cache(self, url, cachedir): cache_loc = url_to_cache(url, cachedir) # can't have a folder name same as file name. replacing '.' with '.' - return os.path.join(cache_loc.replace('.','-'), "tarballs") + return os.path.join(cache_loc.replace('.', '-'), "tarballs") def _are_tarballs_cached(self, image, lava_cachedir): cache_loc = self._tarball_url_to_cache(image, lava_cachedir) @@ -376,7 +396,7 @@ return False # wait x minute for caching is done. - waittime=20 + waittime = 20 logging.info("Waiting for the other instance of lava-dispatcher to finish the caching of %s", image) while waittime > 0: @@ -394,12 +414,12 @@ def _get_cached_tarballs(self, image, tarball_dir, lava_cachedir): cache_loc = self._tarball_url_to_cache(image, lava_cachedir) - boot_tgz = os.path.join(tarball_dir,"boot.tgz") - root_tgz = os.path.join(tarball_dir,"root.tgz") + boot_tgz = os.path.join(tarball_dir, "boot.tgz") + root_tgz = os.path.join(tarball_dir, "root.tgz") link_or_copy_file(os.path.join(cache_loc, "root.tgz"), root_tgz) link_or_copy_file(os.path.join(cache_loc, "boot.tgz"), boot_tgz) - return (boot_tgz,root_tgz) + return (boot_tgz, root_tgz) def _about_to_cache_tarballs(self, image, lava_cachedir): # create this folder to indicate this instance of lava-dispatcher is caching this image. @@ -408,7 +428,7 @@ cache_loc = self._tarball_url_to_cache(image, lava_cachedir) path = os.path.join(cache_loc, "tarballs-cache-ongoing") try: - os.makedirs(path) + os.makedirs(path) except OSError as exc: # Python >2.5 if exc.errno == errno.EEXIST: # other dispatcher process already caching - concurrency issue @@ -428,7 +448,7 @@ def _cache_tarballs(self, image, boot_tgz, root_tgz, lava_cachedir): cache_loc = self._tarball_url_to_cache(image, lava_cachedir) if not os.path.exists(cache_loc): - os.makedirs(cache_loc) + os.makedirs(cache_loc) c_boot_tgz = os.path.join(cache_loc, "boot.tgz") c_root_tgz = os.path.join(cache_loc, "root.tgz") shutil.copy(boot_tgz, c_boot_tgz) @@ -485,10 +505,10 @@ boot_tgz, root_tgz = self._generate_tarballs(image_file) # remove the cached tarballs cache_loc = self._tarball_url_to_cache(image, lava_cachedir) - shutil.rmtree(cache_loc, ignore_errors = true) + shutil.rmtree(cache_loc, ignore_errors=True) # remove the cached image files cache_loc = url_to_cache - shutil.rmtree(cache_loc, ignore_errors = true) + shutil.rmtree(cache_loc, ignore_errors=True) except CriticalError: raise @@ -581,8 +601,10 @@ try: _deploy_linaro_android_testboot(session, boot_url, pkg_url) _deploy_linaro_android_testrootfs(session, system_url, rootfstype) -# _purge_linaro_android_sdcard(session) _deploy_linaro_android_data(session, data_url) + if session.has_partition_with_label('userdata') and \ + session.has_partition_with_label('sdcard'): + _purge_linaro_android_sdcard(session) except: logging.error("Android deployment failed") tb = traceback.format_exc() === modified file 'lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf' --- lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf 2012-05-31 08:26:23 +0000 +++ lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf 2012-06-16 11:11:37 +0000 @@ -73,7 +73,7 @@ # 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 = 7 # data partition number in LAVA test image, counting from 1 data_part_android = 6