From patchwork Wed May 23 21:52:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Le Chi Thu X-Patchwork-Id: 8933 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 B416423E01 for ; Wed, 23 May 2012 21:52:15 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id 68458A18082 for ; Wed, 23 May 2012 21:52:15 +0000 (UTC) Received: by yhpp61 with SMTP id p61so8672184yhp.11 for ; Wed, 23 May 2012 14:52:15 -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=4EhEP3e5Ww/eRDNx4OXUvlBxzzQkAys9at94upmH2A8=; b=gW2EG9ILnc9Yv0TgZZ1lCvQfVldSshKESpG5McpQDcDcJjuFVTJSJ1lpagZpOhBU6p wpVG7TOkCYTvXznm1tLoFE2MEvnr1dHVc0RS0+snHOFx5N66uKcYWIhWHV/7jvUDGqoG HKRfGyjtA755qw4MhfDUr1AdjbkGUcT/1hadG4+X880rxV6xzqo/UjQq8hh1I1vepqpF fx+lsKAfgOC1qbqXZNiTJwJImUtsD8XIbFvggKZUai0quL8qFlFOwOQFgRrZBrIkAaIv W8duhrwgZh5WMvVl62PmThFyOLPhf48wIUgwWJKIVU4kGC5SbcKjxtm2DAOeQdUE7jJn YaKw== Received: by 10.50.163.99 with SMTP id yh3mr14576863igb.53.1337809934718; Wed, 23 May 2012 14:52: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.35.72 with SMTP id o8csp480448ibd; Wed, 23 May 2012 14:52:13 -0700 (PDT) Received: by 10.216.27.199 with SMTP id e49mr16017193wea.45.1337809933183; Wed, 23 May 2012 14:52:13 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id y44si1714196wem.79.2012.05.23.14.52.12 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 23 May 2012 14:52:13 -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 1SXJTY-0000Jr-Js for ; Wed, 23 May 2012 21:52:12 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 8A57DE0167 for ; Wed, 23 May 2012 21:52:12 +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: 297 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 297: Fixed reboot issues Message-Id: <20120523215212.5062.76913.launchpad@ackee.canonical.com> Date: Wed, 23 May 2012 21:52:12 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="15282"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 856d67f4c23384f0e76d4e58be609bcb740b171d X-Gm-Message-State: ALoCoQn5LeltSuPc9hY9juBRlN7PbFcYnUkrj9Rh0RuWUTFiDtyBkovzETRlfl7/8EpEePWuwYig Merge authors: Le Chi Thu le.chi.thu@linaro.org Related merge proposals: https://code.launchpad.net/~le-chi-thu/lava-dispatcher/fix-reboot-issues/+merge/106808 proposed by: Le Chi Thu (le-chi-thu) review: Approve - Michael Hudson-Doyle (mwhudson) review: Approve - Zygmunt Krynicki (zkrynicki) ------------------------------------------------------------ revno: 297 [merge] committer: Le Chi Thu le.chi.thu@linaro.org branch nick: trunk timestamp: Wed 2012-05-23 23:48:23 +0200 message: Fixed reboot issues modified: doc/changes.rst lava_dispatcher/client/base.py lava_dispatcher/client/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 'doc/changes.rst' --- doc/changes.rst 2012-05-17 21:25:09 +0000 +++ doc/changes.rst 2012-05-22 13:12:56 +0000 @@ -1,6 +1,8 @@ Version History *************** +* Fixed reboot issues + .. _version_0_7_1: Version 0.7.1 === modified file 'lava_dispatcher/client/base.py' --- lava_dispatcher/client/base.py 2012-05-17 13:02:48 +0000 +++ lava_dispatcher/client/base.py 2012-05-22 13:03:31 +0000 @@ -411,7 +411,7 @@ # /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, timeout=10) + self.proc.expect(self.tester_str, timeout=120) self.setup_proxy(self.tester_str) logging.info("System is in test image now") @@ -429,6 +429,7 @@ self._boot_linaro_android_image() self.in_test_shell(timeout=900) self.proc.sendline("export PS1=\"root@linaro: \"") + self.proc.expect(self.tester_str, timeout=120) #TODO: set up proxy if self.config.get("enable_network_after_boot_android"): === modified file 'lava_dispatcher/client/master.py' --- lava_dispatcher/client/master.py 2012-05-17 21:02:42 +0000 +++ lava_dispatcher/client/master.py 2012-05-22 13:03:31 +0000 @@ -538,7 +538,7 @@ logging.info("Downloading the image files") proxy = lava_proxy if use_cache else None - + boot_path = download(boot_url, tarball_dir, proxy) system_path = download(system_url, tarball_dir, proxy) data_path = download(data_url, tarball_dir, proxy) @@ -554,17 +554,19 @@ reboot the system, and check that we are in a master shell """ logging.info("Boot the system master image") - self.soft_reboot() try: + self.soft_reboot() image_boot_msg = self.device_option('image_boot_msg') - self.proc.expect(image_boot_msg) + self.proc.expect(image_boot_msg, timeout=300) self._in_master_shell(300) except: logging.exception("in_master_shell failed") self.hard_reboot() + image_boot_msg = self.device_option('image_boot_msg') + self.proc.expect(image_boot_msg, timeout=300) self._in_master_shell(300) self.proc.sendline('export PS1="$PS1 [rc=$(echo \$?)]: "') - self.proc.expect(self.master_str, timeout=10, lava_no_logging=1) + self.proc.expect(self.master_str, timeout=120, lava_no_logging=1) self.setup_proxy(self.master_str) logging.info("System is in master image now") @@ -728,16 +730,19 @@ def soft_reboot(self): logging.info("Perform soft reboot the system") cmd = self.device_option("soft_boot_cmd") + # make sure in the shell (sometime the earlier command has not exit) by sending CTRL + C + self.proc.sendline("\003") if cmd != "": self.proc.sendline(cmd) else: self.proc.sendline("reboot") - # set soft reboot timeout 120s, or do a hard reset + # Looking for reboot messages or if they are missing, the U-Boot message will also indicate the + # reboot is done. id = self.proc.expect( ['Restarting system.', 'The system is going down for reboot NOW', - 'Will now restart', pexpect.TIMEOUT], timeout=120) - if id not in [0, 1, 2]: - self.hard_reboot() + 'Will now restart', 'U-Boot', pexpect.TIMEOUT], timeout=120) + if id not in [0, 1, 2, 3]: + raise Exception("Soft reboot failed") def hard_reboot(self): logging.info("Perform hard reset on the system") @@ -747,6 +752,14 @@ else: self.proc.send("~$") self.proc.sendline("hardreset") + # after hardreset empty the pexpect buffer + self._empty_pexpect_buffer() + def _empty_pexpect_buffer(self): + """Make sure there is nothing in the pexpect buffer.""" + index = 0 + while index == 0: + index = self.proc.expect( + ['.+', pexpect.EOF, pexpect.TIMEOUT], timeout=1, lava_no_logging=1) def _enter_uboot(self): interrupt_boot_prompt = self.device_option('interrupt_boot_prompt') @@ -762,8 +775,8 @@ self._boot(string_to_list(self.config.get('boot_cmds_android'))) def _boot(self, boot_cmds): - self.soft_reboot() try: + self.soft_reboot() self._enter_uboot() except: logging.exception("_enter_uboot failed")