summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/utils
diff options
context:
space:
mode:
authorRandy Witt <randy.e.witt@linux.intel.com>2015-08-26 00:15:15 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-26 08:28:06 +0100
commit315fb4c9e275dcaeab325b9c7647ffe2d262949e (patch)
treeda765ab461cb99792d8faf05eae06202ca390d74 /meta/lib/oeqa/utils
parent778fc612cb584d17da02ecc115c4e6edba995602 (diff)
downloadpoky-315fb4c9e275dcaeab325b9c7647ffe2d262949e.tar.gz
qemurunner: In the logging thread retry on EAGAIN, EWOULDBLOCK
On a nonblocking socket an exception can be generated for the EAGAIN and EWOULDBLOCK errnos. Since these aren't actually errors make sure to retry rather than bailing out. (From OE-Core rev: 2f5cbfee0ab1189fbb83f0e785d79c8d123fccc2) Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/utils')
-rw-r--r--meta/lib/oeqa/utils/qemurunner.py29
1 files changed, 25 insertions, 4 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index d079072af8..6d36df6953 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -412,12 +412,33 @@ class LoggingThread(threading.Thread):
412 412
413 # Actual data to be logged 413 # Actual data to be logged
414 elif self.readsock.fileno() == event[0]: 414 elif self.readsock.fileno() == event[0]:
415 data = self.readsock.recv(1024) 415 data = self.recv_loop()
416 if not data:
417 raise Exception("No data on read ready socket")
418
419 self.logfunc(data) 416 self.logfunc(data)
420 417
418 # Since the socket is non-blocking make sure to honor EAGAIN
419 # and EWOULDBLOCK
420 def recv_loop(self):
421 while True:
422 try:
423 data = self.readsock.recv(1024)
424 break
425 except socket.error as e:
426 if e.errno == errno.EAGAIN or e.errno == errno.EWOULDBLOCK:
427 continue
428 else:
429 raise
430
431 if not data:
432 raise Exception("No data on read ready socket")
433 elif data == 0:
434 # This actually means an orderly shutdown
435 # happened. But for this code it counts as an
436 # error since the connection shouldn't go away
437 # until qemu exits.
438 raise Exception("Console connection closed unexpectedly")
439
440 return data
441
421 def stringify_event(self, event): 442 def stringify_event(self, event):
422 val = '' 443 val = ''
423 if select.POLLERR == event: 444 if select.POLLERR == event: