From patchwork Thu Oct 27 09:21:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Spring Zhang X-Patchwork-Id: 4855 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 DDC9423E04 for ; Thu, 27 Oct 2011 09:28:47 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id C9B60A18302 for ; Thu, 27 Oct 2011 09:28:47 +0000 (UTC) Received: by faan26 with SMTP id n26so3511314faa.11 for ; Thu, 27 Oct 2011 02:28:47 -0700 (PDT) Received: by 10.223.64.207 with SMTP id f15mr9987360fai.7.1319707709970; Thu, 27 Oct 2011 02:28:29 -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.152.1.71 with SMTP id 7cs39267lak; Thu, 27 Oct 2011 02:28:29 -0700 (PDT) Received: by 10.227.203.198 with SMTP id fj6mr15195795wbb.24.1319707709002; Thu, 27 Oct 2011 02:28:29 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id e16si3520629wbh.74.2011.10.27.02.28.28 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Oct 2011 02:28:28 -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 1RJMGC-0007DF-CE for ; Thu, 27 Oct 2011 09:28:28 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 91BA7E0801 for ; Thu, 27 Oct 2011 09: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: 153 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 153: Merge improvement for bug 874594 so the default timeout is shorten to 20mins Message-Id: <20111027092113.17637.59571.launchpad@ackee.canonical.com> Date: Thu, 27 Oct 2011 09:21:13 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="14197"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 7bb412c747775f33ec176257ab1a5632f7895b79 Merge authors: Spring Zhang (qzhang) Related merge proposals: https://code.launchpad.net/~qzhang/lava-dispatcher/fix-874594/+merge/80303 proposed by: Spring Zhang (qzhang) review: Needs Fixing - Yongqin Liu (liuyq0307) review: Resubmit - Spring Zhang (qzhang) ------------------------------------------------------------ revno: 153 [merge] committer: Spring Zhang branch nick: fix-874594 timestamp: Thu 2011-10-27 17:18:48 +0800 message: Merge improvement for bug 874594 so the default timeout is shorten to 20mins modified: lava_dispatcher/__init__.py lava_dispatcher/actions/android_deploy.py lava_dispatcher/actions/boot_control.py lava_dispatcher/actions/lava-test.py lava_dispatcher/client.py lava_dispatcher/connection.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/__init__.py' --- lava_dispatcher/__init__.py 2011-10-27 02:32:02 +0000 +++ lava_dispatcher/__init__.py 2011-10-27 06:12:13 +0000 @@ -25,6 +25,7 @@ from uuid import uuid1 import base64 import pexpect +import logging from lava_dispatcher.actions import get_all_cmds from lava_dispatcher.config import get_config, get_device_config @@ -87,6 +88,7 @@ status = 'pass' finally: err_msg = "" + logging.info("Action %s finished." % cmd['command']) if status == 'fail': err_msg = "Lava failed at action %s with error: %s\n" %\ (cmd['command'], err) === modified file 'lava_dispatcher/actions/android_deploy.py' --- lava_dispatcher/actions/android_deploy.py 2011-10-20 18:24:55 +0000 +++ lava_dispatcher/actions/android_deploy.py 2011-10-24 07:49:16 +0000 @@ -38,7 +38,7 @@ logging.info(" boot: %s" % boot) logging.info(" system: %s" % system) logging.info(" data: %s" % data) - logging.info("Booting master image") + logging.info("Boot master image") client.boot_master_image() logging.info("Waiting for network to come up...") === modified file 'lava_dispatcher/actions/boot_control.py' --- lava_dispatcher/actions/boot_control.py 2011-10-26 02:59:28 +0000 +++ lava_dispatcher/actions/boot_control.py 2011-10-27 09:11:47 +0000 @@ -34,8 +34,8 @@ client.proc.sendline("") try: client.boot_linaro_android_image() - except: - logging.exception("boot_linaro_android_image failed") + except Exception as e: + logging.exception("boot_linaro_android_image failed: %s" % e) raise CriticalError("Failed to boot test image.") class cmd_boot_linaro_image(BaseAction): @@ -61,5 +61,5 @@ """ def run(self): client = self.client - logging.info("Boot Master image") + logging.info("Boot master image") client.boot_master_image() === modified file 'lava_dispatcher/actions/lava-test.py' --- lava_dispatcher/actions/lava-test.py 2011-10-26 02:59:28 +0000 +++ lava_dispatcher/actions/lava-test.py 2011-10-27 06:12:13 +0000 @@ -91,7 +91,10 @@ logging.info("Executing lava_test_run %s command" % test_name) #Make sure in test image now client = self.client - client.in_test_shell() + try: + client.in_test_shell() + except: + client.boot_linaro_image() client.run_cmd_tester('mkdir -p %s' % self.context.lava_result_dir) client.export_display() bundle_name = test_name + "-" + datetime.now().strftime("%H%M%S") === modified file 'lava_dispatcher/client.py' --- lava_dispatcher/client.py 2011-10-27 01:09:17 +0000 +++ lava_dispatcher/client.py 2011-10-27 09:11:47 +0000 @@ -99,15 +99,18 @@ timeout=timeout) if id == 1: raise OperationFailed + logging.info("System is in master image now") - def in_test_shell(self): + def in_test_shell(self, timeout=10): """ Check that we are in a shell on the test image """ self.proc.sendline("") - match_id = self.proc.expect([self.tester_str, pexpect.TIMEOUT]) + match_id = self.proc.expect([self.tester_str, pexpect.TIMEOUT], + timeout=timeout) if match_id == 1: raise OperationFailed + logging.info("System is in test image now") def boot_master_image(self): """ @@ -122,20 +125,20 @@ self.proc.hard_reboot() self.in_master_shell(300) self.proc.sendline('export PS1="$PS1 [rc=$(echo \$?)]: "') - self.proc.expect(self.master_str) + self.proc.expect(self.master_str, timeout=10) def boot_linaro_image(self): """ Reboot the system to the test image """ self.proc._boot(self.boot_cmds) - self.in_test_shell() + self.in_test_shell(300) # set PS1 to include return value of last command # Details: system PS1 is set in /etc/bash.bashrc and user PS1 is set in # /root/.bashrc, it is # "${debian_chroot:+($debian_chroot)}\u@\h:\w\$ " self.proc.sendline('export PS1="$PS1 [rc=$(echo \$?)]: "') - self.proc.expect(self.tester_str) + self.proc.expect(self.tester_str, timeout=10) def run_shell_command(self, cmd, response=None, timeout=-1): self.empty_pexpect_buffer() @@ -228,7 +231,7 @@ def boot_linaro_android_image(self): """Reboot the system to the test android image.""" - self._boot(string_to_list(self.config.get('boot_cmds_android'))) + self.proc._boot(string_to_list(self.config.get('boot_cmds_android'))) self.in_test_shell() self.proc.sendline("export PS1=\"root@linaro: \"") === modified file 'lava_dispatcher/connection.py' --- lava_dispatcher/connection.py 2011-10-26 03:24:05 +0000 +++ lava_dispatcher/connection.py 2011-10-27 06:12:13 +0000 @@ -66,6 +66,7 @@ def soft_reboot(self): self.proc.sendline("reboot") # set soft reboot timeout 120s, or do a hard reset + logging.info("Rebooting the system") id = self.proc.expect( ['Will now restart', pexpect.TIMEOUT], timeout=120) if id != 0: @@ -79,12 +80,13 @@ def _make_connection(self, sio): cmd = "conmux-console %s" % self.device_option("hostname") - proc = pexpect.spawn(cmd, timeout=3600, logfile=sio) + proc = pexpect.spawn(cmd, timeout=1200, logfile=sio) #serial can be slow, races do funny things if you don't increase delay proc.delaybeforesend=1 return proc def hard_reboot(self): + logging.info("Perform hard reset on the system") self.proc.send("~$") self.proc.sendline("hardreset") # XXX Workaround for snowball