From patchwork Sat Dec 15 18:14:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Doan X-Patchwork-Id: 13611 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 207664C1569 for ; Sat, 15 Dec 2012 18:14:17 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 9E497A183E0 for ; Sat, 15 Dec 2012 18:14:16 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so7456896ieb.11 for ; Sat, 15 Dec 2012 10:14:16 -0800 (PST) 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=OZLPX8kx+c5GzI4Yy13wnPIaPzB961hR1o1cGB3tQ1E=; b=nFuqVso7tb8q/1YU9tY59ucfql9PB2PRH4uXWSYvNS6ftH00VJiTz7Xc++3lAnmkbm /95Ap9Bk664GYMq7meVR3tugVL4IXgCJLls4c3UF+sVumvloH0yoUz/mDCDcKGTTs9R5 KFhHIQ4WdaUqZb4SkRpesuqFVK3aGyvYC2QvVGulXNuqdjgvyIVzka/qH+OCufrCQYWR S9Ywh9y5HtDFgdRZxn03dEu2ak2mIhwuUIcY2rLNUQquh99zGW3hrsL4cqHuTTs4CSG7 dgpmyY3P/4fGbnecfWQTR6FydbJsGzcBrJuLZpSFf8ioYmDolaQD99jkQDPVomtXj27h KAKg== Received: by 10.50.36.164 with SMTP id r4mr4955699igj.57.1355595255859; Sat, 15 Dec 2012 10:14:15 -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.50.67.148 with SMTP id n20csp139501igt; Sat, 15 Dec 2012 10:14:15 -0800 (PST) Received: by 10.181.13.75 with SMTP id ew11mr8333342wid.9.1355595254066; Sat, 15 Dec 2012 10:14:14 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id fu4si2678027wib.20.2012.12.15.10.14.13 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 15 Dec 2012 10:14:14 -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 1TjwFZ-0001uc-FY for ; Sat, 15 Dec 2012 18:14:13 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 69848E025F for ; Sat, 15 Dec 2012 18:14: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: 501 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 501: introduce global delay in our serial console send routine Message-Id: <20121215181413.3590.14211.launchpad@ackee.canonical.com> Date: Sat, 15 Dec 2012 18:14: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="16372"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 2e3cef7f7083e1349a86c95ea4ec135a88a96ffc X-Gm-Message-State: ALoCoQliWddk2Yn48YSPJJW3X+sIbgB+BZLqu7tSB2WD4CglMNDjhtZmJYVUL3ozEhoCcK0IxWs+ ------------------------------------------------------------ revno: 501 committer: Andy Doan branch nick: lava-dispatcher timestamp: Fri 2012-12-14 10:37:42 -0600 message: introduce global delay in our serial console send routine We've seen issues where sending things like 16 byte or bigger strings can often get messed up in serial console implementations. This has been seen with our PS1 prompt on panda and seems to be fairly consistent on TC2 in a couple of places. Introducing a small .05 second delay seems to make things work well on TC2 and is small enough to not really annoy anyone. So this seems worth fixing in general. I also fixed a few pylint warnings in this class while I was looking at it. modified: lava_dispatcher/device/master.py lava_dispatcher/utils.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/device/master.py' --- lava_dispatcher/device/master.py 2012-12-13 21:23:55 +0000 +++ lava_dispatcher/device/master.py 2012-12-14 16:37:42 +0000 @@ -338,8 +338,6 @@ while retry_count < retry_limit: proc = logging_spawn(cmd, timeout=1200) proc.logfile_read = self.sio - #serial can be slow, races do funny things, so increase delay - proc.delaybeforesend = 1 logging.info('Attempting to connect to device') match = proc.expect(patterns, timeout=10) result = results[match] === modified file 'lava_dispatcher/utils.py' --- lava_dispatcher/utils.py 2012-11-26 19:30:28 +0000 +++ lava_dispatcher/utils.py 2012-12-14 16:37:42 +0000 @@ -163,13 +163,23 @@ class logging_spawn(pexpect.spawn): + def __init__(self, command, timeout=30, logfile=None): + pexpect.spawn.__init__( + self, command, timeout=timeout, logfile=logfile) + + # serial can be slow, races do funny things, so increase delay + self.delaybeforesend = 0.05 + def sendline(self, s=''): - logging.debug("sendline : %s" % s) + logging.debug("sendline : %s", s) return super(logging_spawn, self).sendline(s) - def send(self, *args, **kw): - logging.debug("send : %s" % args[0]) - return super(logging_spawn, self).send(*args, **kw) + def send(self, string): + logging.debug("send : %s", string) + sent = 0 + for char in string: + sent += super(logging_spawn, self).send(char) + return sent def expect(self, *args, **kw): # some expect should not be logged because it is so much noise. @@ -183,9 +193,9 @@ timeout = self.timeout if len(args) == 1: - logging.debug("expect (%d): '%s'" % (timeout, args[0])) + logging.debug("expect (%d): '%s'", timeout, args[0]) else: - logging.debug("expect (%d): '%s'" % (timeout, str(args))) + logging.debug("expect (%d): '%s'", timeout, str(args)) return super(logging_spawn, self).expect(*args, **kw)