summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/utils
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:38:03 +0100
commit1e8d03827db9e8e2588f3742994eab53bbf20e5f (patch)
treee95b7a5e91629a9aa7715ad225c499ff30360c68 /meta/lib/oeqa/utils
parent63340aefe538471086f62e380ad4ac85d9c993a9 (diff)
downloadpoky-1e8d03827db9e8e2588f3742994eab53bbf20e5f.tar.gz
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. (From OE-Core rev: 3aad1f489f38e999914ee6ccbf87367b9a75ee5e) 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/oeqa/utils')
-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:
139 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))) 139 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)))
140 self.stop() 140 self.stop()
141 return False 141 return False
142 logger.info("qemu cmdline used:\n{}".format(cmdline))
142 logger.info("Target IP: %s" % self.ip) 143 logger.info("Target IP: %s" % self.ip)
143 logger.info("Server IP: %s" % self.server_ip) 144 logger.info("Server IP: %s" % self.server_ip)
144 145
@@ -368,6 +369,7 @@ class LoggingThread(threading.Thread):
368 os.write(self.writepipe, "stop") 369 os.write(self.writepipe, "stop")
369 370
370 def teardown(self): 371 def teardown(self):
372 self.logger.info("Tearing down logging thread")
371 self.close_socket(self.serversock) 373 self.close_socket(self.serversock)
372 374
373 if self.readsock is not None: 375 if self.readsock is not None:
@@ -412,25 +414,23 @@ class LoggingThread(threading.Thread):
412 414
413 # Actual data to be logged 415 # Actual data to be logged
414 elif self.readsock.fileno() == event[0]: 416 elif self.readsock.fileno() == event[0]:
415 data = self.recv_loop() 417 data = self.recv(1024)
416 self.logfunc(data) 418 self.logfunc(data)
417 419
418 # Since the socket is non-blocking make sure to honor EAGAIN 420 # Since the socket is non-blocking make sure to honor EAGAIN
419 # and EWOULDBLOCK 421 # and EWOULDBLOCK.
420 def recv_loop(self): 422 def recv(self, count):
421 while True: 423 try:
422 try: 424 data = self.readsock.recv(count)
423 data = self.readsock.recv(1024) 425 except socket.error as e:
424 break 426 if e.errno == errno.EAGAIN or e.errno == errno.EWOULDBLOCK:
425 except socket.error as e: 427 return ''
426 if e.errno == errno.EAGAIN or e.errno == errno.EWOULDBLOCK: 428 else:
427 continue 429 raise
428 else:
429 raise
430 430
431 if not data: 431 if data is None:
432 raise Exception("No data on read ready socket") 432 raise Exception("No data on read ready socket")
433 elif data == 0: 433 elif not data:
434 # This actually means an orderly shutdown 434 # This actually means an orderly shutdown
435 # happened. But for this code it counts as an 435 # happened. But for this code it counts as an
436 # error since the connection shouldn't go away 436 # error since the connection shouldn't go away