From patchwork Mon Jan 21 02:45:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongqin Liu X-Patchwork-Id: 14121 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 2BFEB23EAD for ; Mon, 21 Jan 2013 02:45:21 +0000 (UTC) Received: from mail-vb0-f52.google.com (mail-vb0-f52.google.com [209.85.212.52]) by fiordland.canonical.com (Postfix) with ESMTP id C8AE9A18960 for ; Mon, 21 Jan 2013 02:45:20 +0000 (UTC) Received: by mail-vb0-f52.google.com with SMTP id fa15so2335398vbb.39 for ; Sun, 20 Jan 2013 18:45:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :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=Wrjg8Z55RKV/UKvHYeczykL1ngE+0H3bvvOQITbHQAY=; b=RPhd47ycmylXKICc2Or163PiFxW3/Li24OS5ZbLy5aJqoJOYXQyLKmDkgxEDiuUVIT Hipb1l1mZ5GfZBjh+7CvgUl1yPJWCQwVi5uwLlKi0iChDfVSDaRwY6MiinXTunVAtXGv 3X0FATFRILqT5rTI/NFH+qe9Njopw0TOVrCtPFRrCZw5yOaUkPZkI7hDjmMG+ic56sMQ Z4vbyLgiL0hmBdfF8W5YNhDw9JpjHP8BYrT+WLv4AotMx+VVwIIccjYcuv6FSorPyue+ k6YNYfhw7Gtn+/8md7utkVXXYRbU4VH3zZi8BvyUrvlJ43r+peXJ3pYdKaur0GjPbtGQ 4ubw== X-Received: by 10.52.97.7 with SMTP id dw7mr15766712vdb.38.1358736320083; Sun, 20 Jan 2013 18:45:20 -0800 (PST) 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.58.145.101 with SMTP id st5csp182617veb; Sun, 20 Jan 2013 18:45:19 -0800 (PST) X-Received: by 10.194.87.200 with SMTP id ba8mr23768215wjb.22.1358736318711; Sun, 20 Jan 2013 18:45:18 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id bg10si4433174wjb.216.2013.01.20.18.45.17 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 20 Jan 2013 18:45:18 -0800 (PST) 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 1Tx7Nt-0005Wn-8q for ; Mon, 21 Jan 2013 02:45:17 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 310D2E001F for ; Mon, 21 Jan 2013 02:45:17 +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: 532 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 532: change to use Launcher information in logcat to check the display of home screen Message-Id: <20130121024517.23539.68036.launchpad@ackee.canonical.com> Date: Mon, 21 Jan 2013 02:45:17 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="16430"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 4870c0ccf64b648bf1ddd8c4a7bf35c26e2e017c X-Gm-Message-State: ALoCoQnkJSKuEg8XvIb4tw9B7qmyyNY84v8OlxPPz/JDhM5FKFPIA5+EEB7n2G8rOyQqxVqWdh/R Merge authors: Yongqin Liu (liuyq0307) Related merge proposals: https://code.launchpad.net/~liuyq0307/lava-dispatcher/check-home-screen/+merge/143643 proposed by: Yongqin Liu (liuyq0307) review: Approve - Andy Doan (doanac) ------------------------------------------------------------ revno: 532 [merge] committer: Yongqin Liu branch nick: lava-dispatcher timestamp: Mon 2013-01-21 10:44:08 +0800 message: change to use Launcher information in logcat to check the display of home screen 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 === modified file 'lava_dispatcher/client/base.py' --- lava_dispatcher/client/base.py 2013-01-14 16:29:38 +0000 +++ lava_dispatcher/client/base.py 2013-01-19 03:43:23 +0000 @@ -35,6 +35,7 @@ GeneralError, NetworkError, OperationFailed, + CriticalError, ) from lava_dispatcher.test_data import create_attachment @@ -90,7 +91,8 @@ def wait_for_prompt(self, timeout = -1): wait_for_prompt(self._connection, self._prompt_str, timeout) - def run(self, cmd, response=None, timeout=-1, failok=False): + def run(self, cmd, response=None, timeout=-1, + failok=False, wait_prompt=True): """Run `cmd` and wait for a shell response. :param cmd: The command to execute. @@ -124,15 +126,19 @@ self.match_id = None self.match = None - self.wait_for_prompt(timeout) + if wait_prompt: + self.wait_for_prompt(timeout) - if self._prompt_str_includes_rc: - rc = int(self._connection.match.group(1)) - if rc != 0 and not failok: - raise OperationFailed( - "executing %r failed with code %s" % (cmd, rc)) + if self._prompt_str_includes_rc: + rc = int(self._connection.match.group(1)) + if rc != 0 and not failok: + raise OperationFailed( + "executing %r failed with code %s" % (cmd, rc)) + else: + rc = None else: rc = None + return rc @@ -290,17 +296,22 @@ "The android device(%s) isn't attached" % self._client.hostname) def wait_home_screen(self): - cmd = 'getprop init.svc.bootanim' - tries = self._client.config.android_home_screen_tries - for count in range(tries): - logging.debug("Waiting for home screen (%d/%d)", count, tries) - try: - self.run(cmd, response=['stopped'], timeout=5) - if self.match_id == 0: - return True - except pexpect.TIMEOUT: - time.sleep(1) - raise GeneralError('The home screen has not displayed') + timeout = self._client.config.android_home_screen_timeout + launcher_pat = ('Displayed com.android.launcher/' + 'com.android.launcher2.Launcher:') + #waiting for the home screen displayed + try: + self.run('logcat -s ActivityManager:I', + response=[launcher_pat], + timeout=timeout, wait_prompt=False) + except pexpect.TIMEOUT: + raise GeneralError('The home screen has not displayed') + finally: + #send ctrl+c to exit the logcat command, + #and make the latter command can be run on the normal + #command line session, instead of the session of logcat command + self._connection.sendcontrol("c") + self.run('') def check_device_state(self): (rc, output) = commands.getstatusoutput('adb devices') @@ -439,8 +450,9 @@ """Reboot the system to the test android image.""" self._boot_linaro_android_image() TESTER_PS1_PATTERN = self.target_device.deployment_data['TESTER_PS1_PATTERN'] + timeout = self.config.android_boot_prompt_timeout try: - wait_for_prompt(self.proc, TESTER_PS1_PATTERN, timeout=900) + wait_for_prompt(self.proc, TESTER_PS1_PATTERN, timeout=timeout) except pexpect.TIMEOUT: raise OperationFailed("booting into android test image failed") #TODO: set up proxy === modified file 'lava_dispatcher/config.py' --- lava_dispatcher/config.py 2013-01-10 21:37:58 +0000 +++ lava_dispatcher/config.py 2013-01-18 11:08:24 +0000 @@ -83,7 +83,8 @@ android_adb_over_usb = schema.BoolOption(default=False) android_adb_over_tcp = schema.BoolOption(default=True) android_wait_for_home_screen = schema.BoolOption(default=True) - android_home_screen_tries = schema.IntOption(default=100) + android_home_screen_timeout = schema.IntOption(default=1800) + android_boot_prompt_timeout = schema.IntOption(default=1200) android_orig_block_device = schema.StringOption(default="mmcblk0") android_lava_block_device = schema.StringOption(default="mmcblk0")