diff options
Diffstat (limited to 'meta/lib/oeqa/utils/qemurunner.py')
-rw-r--r-- | meta/lib/oeqa/utils/qemurunner.py | 29 |
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: |