From patchwork Wed Sep 14 16:08:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Larson X-Patchwork-Id: 4074 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 1586323EF7 for ; Wed, 14 Sep 2011 16:13:26 +0000 (UTC) Received: from mail-ew0-f48.google.com (mail-ew0-f48.google.com [209.85.215.48]) by fiordland.canonical.com (Postfix) with ESMTP id 018ECA18904 for ; Wed, 14 Sep 2011 16:13:25 +0000 (UTC) Received: by ewy26 with SMTP id 26so1145602ewy.21 for ; Wed, 14 Sep 2011 09:13:25 -0700 (PDT) Received: by 10.223.5.76 with SMTP id 12mr8383fau.103.1316016805633; Wed, 14 Sep 2011 09:13:25 -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.11.8 with SMTP id m8cs56730lab; Wed, 14 Sep 2011 09:13:25 -0700 (PDT) Received: by 10.227.203.213 with SMTP id fj21mr15138wbb.69.1316016805013; Wed, 14 Sep 2011 09:13:25 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id ek2si4117735wbb.15.2011.09.14.09.13.24 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 14 Sep 2011 09:13:25 -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 1R3s5T-0008Ph-RE for ; Wed, 14 Sep 2011 16:13:23 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 37A17E1747 for ; Wed, 14 Sep 2011 16:08: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: 108 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 108: Empty the pexpect buffer before sending the next command over the serial Message-Id: <20110914160813.11711.85479.launchpad@ackee.canonical.com> Date: Wed, 14 Sep 2011 16:08: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="13921"; Instance="initZopeless config overlay" X-Launchpad-Hash: 8f83fd77ffe26d4d0522e91aec21c663ba59d63d Merge authors: Le Chi Thu le.chi.thu@linaro.org Related merge proposals: https://code.launchpad.net/~le-chi-thu/lava-dispatcher/empty-pexpect-buffer/+merge/74951 proposed by: Le Chi Thu (le-chi-thu) ------------------------------------------------------------ revno: 108 [merge] committer: Paul Larson branch nick: big-dispatcher-merge timestamp: Wed 2011-09-14 09:43:58 -0500 message: Empty the pexpect buffer before sending the next command over the serial line modified: lava_dispatcher/actions/lava-test.py lava_dispatcher/client.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/actions/lava-test.py' --- lava_dispatcher/actions/lava-test.py 2011-09-10 03:24:21 +0000 +++ lava_dispatcher/actions/lava-test.py 2011-09-14 14:43:58 +0000 @@ -72,7 +72,6 @@ client.run_shell_command( 'chroot /mnt/root lava-test help', response="list-test", timeout=10) - client.proc.expect(client.master_str, timeout=10) except: tb = traceback.format_exc() client.sio.write(tb) === modified file 'lava_dispatcher/client.py' --- lava_dispatcher/client.py 2011-09-10 03:24:21 +0000 +++ lava_dispatcher/client.py 2011-09-14 14:43:58 +0000 @@ -150,6 +150,7 @@ self.proc.sendline("hardreset") def run_shell_command(self, cmd, response=None, timeout=-1): + self.empty_pexpect_buffer() # return return-code if captured, else return None self.proc.sendline(cmd) #verify return value of last command, match one number at least @@ -222,6 +223,10 @@ def get_seriallog(self): return self.sio.getvalue() + def empty_pexpect_buffer(self): + index = 0 + while (index == 0): + index = self.proc.expect (['.+', pexpect.EOF, pexpect.TIMEOUT], timeout=1) class SerialIO(file): def __init__(self, logfile):