summaryrefslogtreecommitdiff
path: root/meta/lib
diff options
context:
space:
mode:
authorRandy Witt <randy.e.witt@linux.intel.com>2015-08-27 02:04:10 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-29 13:17:50 +0100
commit3aad1f489f38e999914ee6ccbf87367b9a75ee5e (patch)
tree5df9b1acfc95bb1f2ccac4c1cb55106df2be54dc /meta/lib
parentc71309616a3247cfab969b74d8642ff0bf9b6500 (diff)
downloadopenembedded-core-3aad1f489f38e999914ee6ccbf87367b9a75ee5e.tar.gz
openembedded-core-3aad1f489f38e999914ee6ccbf87367b9a75ee5e.tar.bz2
openembedded-core-3aad1f489f38e999914ee6ccbf87367b9a75ee5e.zip
qemurunner: Don't loop on EWOULDBLOCK in logging thread.
EAGAIN/EWOULDBLOCK can be followed by no data. So don't tight loop waiting for data. Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/utils/qemurunner.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 6d36df6953..bcdb69b38c 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -139,6 +139,7 @@ class QemuRunner:
logger.info("Couldn't get ip from qemu process arguments! Here is the qemu command line used:\n%s\nand output from runqemu:\n%s" % (cmdline, getOutput(output)))
self.stop()
return False
+ logger.info("qemu cmdline used:\n{}".format(cmdline))
logger.info("Target IP: %s" % self.ip)
logger.info("Server IP: %s" % self.server_ip)
@@ -368,6 +369,7 @@ class LoggingThread(threading.Thread):
os.write(self.writepipe, "stop")
def teardown(self):
+ self.logger.info("Tearing down logging thread")
self.close_socket(self.serversock)
if self.readsock is not None:
@@ -412,25 +414,23 @@ class LoggingThread(threading.Thread):
# Actual data to be logged
elif self.readsock.fileno() == event[0]:
- data = self.recv_loop()
+ data = self.recv(1024)
self.logfunc(data)
# Since the socket is non-blocking make sure to honor EAGAIN
- # and EWOULDBLOCK
- def recv_loop(self):
- while True:
- try:
- data = self.readsock.recv(1024)
- break
- except socket.error as e:
- if e.errno == errno.EAGAIN or e.errno == errno.EWOULDBLOCK:
- continue
- else:
- raise
+ # and EWOULDBLOCK.
+ def recv(self, count):
+ try:
+ data = self.readsock.recv(count)
+ except socket.error as e:
+ if e.errno == errno.EAGAIN or e.errno == errno.EWOULDBLOCK:
+ return ''
+ else:
+ raise
- if not data:
+ if data is None:
raise Exception("No data on read ready socket")
- elif data == 0:
+ elif not data:
# This actually means an orderly shutdown
# happened. But for this code it counts as an
# error since the connection shouldn't go away