Merge lp:~le-chi-thu/lava-dispatcher/empty-pexpect-buffer into lp:lava-dispatcher

Proposed by Le Chi Thu
Status: Merged
Merged at revision: 108
Proposed branch: lp:~le-chi-thu/lava-dispatcher/empty-pexpect-buffer
Merge into: lp:lava-dispatcher
Diff against target: 22 lines (+5/-0)
1 file modified
lava_dispatcher/client.py (+5/-0)
To merge this branch: bzr merge lp:~le-chi-thu/lava-dispatcher/empty-pexpect-buffer
Reviewer Review Type Date Requested Status
Linaro Validation Team Pending
Review via email: mp+74951@code.launchpad.net

Description of the change

To post a comment you must log in.
Revision history for this message
Paul Larson (pwlars) wrote :

I think this should mostly work, but I'm a bit leery of it because I tried some similar things and ran into issues at one point. We've worked around the core issue in the bug for the moment, and some other recent changes should also help prevent it from coming up again I think. We can leave this open for right now, but it might not be needed.

Revision history for this message
Le Chi Thu (le-chi-thu) wrote :

Unless you know the reason why this fix is bad, I prefer you merge it in. It
solved the random problems I got when testing the lava-dispatcher.

BR

/Chi Thu

On 14 September 2011 06:28, Paul Larson <email address hidden> wrote:

> I think this should mostly work, but I'm a bit leery of it because I tried
> some similar things and ran into issues at one point. We've worked around
> the core issue in the bug for the moment, and some other recent changes
> should also help prevent it from coming up again I think. We can leave this
> open for right now, but it might not be needed.
> --
>
> https://code.launchpad.net/~le-chi-thu/lava-dispatcher/empty-pexpect-buffer/+merge/74951
> You are the owner of lp:~le-chi-thytu/lava-dispatcher/empty-pexpect-buffer.
>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lava_dispatcher/client.py'
2--- lava_dispatcher/client.py 2011-09-10 03:02:04 +0000
3+++ lava_dispatcher/client.py 2011-09-12 07:36:24 +0000
4@@ -142,6 +142,7 @@
5 self.proc.sendline("hardreset")
6
7 def run_shell_command(self, cmd, response=None, timeout=-1):
8+ self.empty_pexpect_buffer()
9 self.proc.sendline(cmd)
10 if response:
11 self.proc.expect(response, timeout=timeout)
12@@ -203,6 +204,10 @@
13 def get_seriallog(self):
14 return self.sio.getvalue()
15
16+ def empty_pexpect_buffer(self):
17+ index = 0
18+ while (index == 0):
19+ index = self.proc.expect (['.+', pexpect.EOF, pexpect.TIMEOUT], timeout=1)
20
21 class SerialIO(file):
22 def __init__(self, logfile):

Subscribers

People subscribed via source and target branches