From patchwork Mon May 13 11:21:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Pigott X-Patchwork-Id: 16877 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AD91D25E14 for ; Mon, 13 May 2013 11:21:49 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id t10sf1374383eei.2 for ; Mon, 13 May 2013 04:21:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-beenthere:x-received:received-spf:x-received :x-forwarded-to:x-forwarded-for:delivered-to:x-received:received-spf :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:x-original-sender :x-original-authentication-results:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=vOqPBkseCDkENQpuOd4BDsb9+URfhH4MQvOnbdmiRII=; b=FDtyPOJur3xqyVPprrhacVOVyGVrkAV1t6rOGuC+6Iu8JDeckl2TRvmc7nYk0XG/M5 oDB59ov1umePlurQoIvA0qgfyJ5q/bcCd2oQt2Y9UbdjL4Nd9KC/tKfq0mY47MMHtBDs XMiFLIaaSd4+AggvoKfbmdCW3bbmPwikuS22wvEhxRl9zou4f7J+f5cFp83u1tYbPhyN xIbplBNDK7Qah71gl0gECRkjg2QKF/NdPLZdlz85VMzTaz73Zv+GHT+raHAaSDM0AkQ8 /NXUaE04JdlBnynHhFvwMkYU+Eb8j0Tcwq5awkfmYYTZ0+rRSzo9IUKSiuZ8Vcm4QdJZ OjPQ== X-Received: by 10.180.160.212 with SMTP id xm20mr1416968wib.0.1368444076256; Mon, 13 May 2013 04:21:16 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.180.100.1 with SMTP id eu1ls712020wib.27.gmail; Mon, 13 May 2013 04:21:16 -0700 (PDT) X-Received: by 10.194.61.45 with SMTP id m13mr39458777wjr.20.1368444076178; Mon, 13 May 2013 04:21:16 -0700 (PDT) Received: from mail-ve0-x236.google.com (mail-ve0-x236.google.com [2607:f8b0:400c:c01::236]) by mx.google.com with ESMTPS id e13si4007230wjr.101.2013.05.13.04.21.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 13 May 2013 04:21:16 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::236 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::236; Received: by mail-ve0-f182.google.com with SMTP id da11so4191194veb.27 for ; Mon, 13 May 2013 04:21:15 -0700 (PDT) X-Received: by 10.220.11.1 with SMTP id r1mr318583vcr.14.1368444075025; Mon, 13 May 2013 04:21:15 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.217.15 with SMTP id hk15csp14676vcb; Mon, 13 May 2013 04:21:14 -0700 (PDT) X-Received: by 10.194.95.9 with SMTP id dg9mr39319807wjb.45.1368444074022; Mon, 13 May 2013 04:21:14 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id g15si2950581wiv.55.2013.05.13.04.21.13 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 13 May 2013 04:21:14 -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; Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1Ubqob-0000Ef-Ii for ; Mon, 13 May 2013 11:21:13 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 7C682E063A for ; Mon, 13 May 2013 11:21:13 +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: 597 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 597: Add reboot for test images Message-Id: <20130513112113.9717.30527.launchpad@ackee.canonical.com> Date: Mon, 13 May 2013 11:21:13 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: list X-Generated-By: Launchpad (canonical.com); Revision="16614"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 452923a21319cdb8207593eda897f3765091494a X-Gm-Message-State: ALoCoQk/0dgg/tuu7B+JSYYTCDsV/uLvGyyu2ZtTlVWU+8dbp9rw1tOLx8lsJq3IYCc9XhWKhj5a X-Original-Sender: noreply@launchpad.net X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::236 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Merge authors: Dave Pigott (dpigott) Related merge proposals: https://code.launchpad.net/~dpigott/lava-dispatcher/add-reboot-for-test-images/+merge/152340 proposed by: Dave Pigott (dpigott) review: Approve - Tyler Baker (tyler-baker) ------------------------------------------------------------ revno: 597 [merge] committer: dave.pigott@linaro.org branch nick: trunk timestamp: Mon 2013-05-13 12:20:17 +0100 message: Add reboot for test images modified: lava_dispatcher/client/base.py lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf lava_dispatcher/device/master.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-04-23 11:34:45 +0000 +++ lava_dispatcher/client/base.py 2013-05-13 11:20:17 +0000 @@ -422,13 +422,37 @@ Reboot the system to the test image """ logging.info("Boot the test image") - - self._boot_linaro_image() - timeout = self.config.boot_linaro_timeout - TESTER_PS1_PATTERN = self.target_device.deployment_data['TESTER_PS1_PATTERN'] - wait_for_prompt(self.proc, TESTER_PS1_PATTERN, timeout=timeout) - self.setup_proxy(TESTER_PS1_PATTERN) - logging.info("System is in test image now") + boot_attempts = self.config.boot_retries + attempts = 0 + in_linaro_image = False + while (attempts < boot_attempts) and (not in_linaro_image): + logging.info("Booting the test image. Attempt: %d" % attempts + 1) + try: + self._boot_linaro_image() + except (OperationFailed, pexpect.TIMEOUT) as e: + msg = "Boot linaro image failed: %s" % e + logging.info(msg) + attempts += 1 + continue + + timeout = self.config.boot_linaro_timeout + TESTER_PS1_PATTERN = self.target_device.deployment_data['TESTER_PS1_PATTERN'] + try: + wait_for_prompt(self.proc, TESTER_PS1_PATTERN, timeout=timeout) + except (pexpect.TIMEOUT) as e: + msg = "Timeout waiting for boot prompt: %s" % e + logging.info(msg) + attempts += 1 + continue + + self.setup_proxy(TESTER_PS1_PATTERN) + logging.info("System is in test image now") + in_linaro_image = True + + if not in_linaro_image: + msg = "Could not get master image booted properly" + logging.critical(msg) + raise CriticalError(msg) def get_www_scratch_dir(self): """ returns a temporary directory available for downloads that gets @@ -449,27 +473,74 @@ def boot_linaro_android_image(self, adb_check=False): """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=timeout) - except pexpect.TIMEOUT: + boot_attempts = self.config.boot_retries + attempts = 0 + in_linaro_android_image = False + + while (attempts < boot_attempts) and (not in_linaro_android_image): + logging.info("Booting the android test image. Attempt: %d" % attempts + 1) + try: + self._boot_linaro_android_image() + except (OperationFailed, pexpect.TIMEOUT) as e: + msg = "Failed to boot Linaro Android Image: %s" % e + logging.info(msg) + attempts += 1 + continue + + 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=timeout) + except pexpect.TIMEOUT: + msg = "Timeout waiting for boot prompt" + logging.info(msg) + attempts += 1 + continue + + #TODO: set up proxy + + if not self.config.android_adb_over_usb: + try: + self._disable_adb_over_usb() + except (OperationFailed, pexpect.TIMEOUT) as e: + msg = "Failed to disable adb: %s" % e + logging.info(msg) + attempts += 1 + continue + + if self.config.android_disable_suspend: + try: + self._disable_suspend() + except (OperationFailed, pexpect.TIMEOUT) as e: + msg = "Failed to disable suspend: %s" % e + logging.info(msg) + attempts += 1 + continue + + if self.config.enable_network_after_boot_android: + time.sleep(1) + try: + self._enable_network() + except (OperationFailed, pexpect.TIMEOUT) as e: + msg = "Failed to enable network: %s" % e + logging.info(msg) + attempts += 1 + continue + + if self.config.android_adb_over_tcp: + try: + self._enable_adb_over_tcp() + except (OperationFailed, pexpect.TIMEOUT) as e: + msg = "Failed to enable adp over tcp: %s" % e + logging.info(msg) + attempts += 1 + continue + + in_linaro_image = True + + if not in_linaro_android_image: raise OperationFailed("booting into android test image failed") - #TODO: set up proxy - - if not self.config.android_adb_over_usb: - self._disable_adb_over_usb() - - if self.config.android_disable_suspend: - self._disable_suspend() - - if self.config.enable_network_after_boot_android: - time.sleep(1) - self._enable_network() - - if self.config.android_adb_over_tcp: - self._enable_adb_over_tcp() + #check if the adb connection can be created. #by adb connect dev_ip command === modified file 'lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf' --- lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf 2013-04-29 10:31:06 +0000 +++ lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf 2013-05-13 11:20:17 +0000 @@ -131,3 +131,6 @@ # obtained from boot.txt or uEnv.txt and others. Can be overridden in device # specific config file. testboot_offset = 2 +======= +# How many times the dispatcher should try to reboot master and test images before failing +boot_retries = 3 === modified file 'lava_dispatcher/device/master.py' --- lava_dispatcher/device/master.py 2013-05-09 02:56:57 +0000 +++ lava_dispatcher/device/master.py 2013-05-13 11:20:17 +0000 @@ -394,10 +394,11 @@ """ reboot the system, and check that we are in a master shell """ - attempts = 3 + boot_attempts = self.config.boot_retries + attempts = 0 in_master_image = False - while (attempts > 0) and (not in_master_image): - logging.info("Booting the system master image") + while (attempts < boot_attempts) and (not in_master_image): + logging.info("Booting the system master image. Attempt: %d" % attempts + 1) try: self._soft_reboot() self._wait_for_master_boot() @@ -409,7 +410,7 @@ except (OperationFailed, pexpect.TIMEOUT) as e: msg = "Hard reboot into master image failed: %s" % e logging.warning(msg) - attempts = attempts - 1 + attempts += 1 continue try: @@ -419,7 +420,7 @@ except pexpect.TIMEOUT as e: msg = "Failed to get command line prompt: " % e logging.warning(msg) - attempts = attempts - 1 + attempts += 1 continue runner = MasterCommandRunner(self) @@ -429,7 +430,7 @@ except NetworkError as e: msg = "Failed to get network up: " % e logging.warning(msg) - attempts = attempts - 1 + attempts += 1 continue lava_proxy = self.context.config.lava_proxy