qemurunner: Remove the timeout in run_serial

Sometmes when there is high load in the server the
commands executed in the target take a lot of time
to complete and this lead to incorrect dump files or
empty files. This is caused because run_serial has a
timeout of five seconds when running the commands in
the target.

This change removes the timeout and just keep reading
the socket until it finds the prompt from the target
or when the socket is not ready to be read.

[YOCTO #8510]

(From OE-Core rev: d1a97475b4e6c7066a3161cb9cec1d4b27644518)

Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Mariano Lopez 2015-11-05 09:08:58 +00:00 committed by Richard Purdie
parent bbd6d07c98
commit 3b95964bc1
1 changed files with 10 additions and 8 deletions

View File

@ -366,23 +366,25 @@ class QemuRunner:
# We assume target system have echo to get command status
if not raw:
command = "%s; echo $?\n" % command
self.server_socket.sendall(command)
data = ''
status = 0
stopread = False
endtime = time.time()+5
while time.time()<endtime and not stopread:
self.server_socket.sendall(command)
keepreading = True
while keepreading:
sread, _, _ = select.select([self.server_socket],[],[],5)
for sock in sread:
answer = sock.recv(1024)
if sread:
answer = self.server_socket.recv(1024)
if answer:
data += answer
# Search the prompt to stop
if re.search("[a-zA-Z0-9]+@[a-zA-Z0-9\-]+:~#", data):
stopread = True
break
keepreading = False
else:
raise Exception("No data on serial console socket")
else:
keepreading = False
if data:
if raw:
status = 1