qemurunner.py: Performance improvements in run_serial

This allow to search for the prompt after a command is
run so it can avoid waiting for the timeout.

Also corrected identation issues

[YOCTO #8118]

(From OE-Core rev: 600f35c0873a61f8cd02c0e5cc1495ce7785ea89)

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-08-12 08:37:28 +00:00 committed by Richard Purdie
parent c0c463be28
commit 51d8e8fb37
1 changed files with 12 additions and 8 deletions

View File

@ -284,14 +284,18 @@ class QemuRunner:
stopread = False
endtime = time.time()+5
while time.time()<endtime and not stopread:
sread, _, _ = select.select([self.server_socket],[],[],5)
for sock in sread:
answer = sock.recv(1024)
if answer:
data += answer
else:
sock.close()
stopread = True
sread, _, _ = select.select([self.server_socket],[],[],5)
for sock in sread:
answer = sock.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
else:
sock.close()
stopread = True
if data:
if raw:
status = 1