summaryrefslogtreecommitdiff
path: root/poky/meta/lib/oeqa/utils
diff options
context:
space:
mode:
Diffstat (limited to 'poky/meta/lib/oeqa/utils')
-rw-r--r--poky/meta/lib/oeqa/utils/qemurunner.py61
1 files changed, 30 insertions, 31 deletions
diff --git a/poky/meta/lib/oeqa/utils/qemurunner.py b/poky/meta/lib/oeqa/utils/qemurunner.py
index 69fee2751..0032f6ed8 100644
--- a/poky/meta/lib/oeqa/utils/qemurunner.py
+++ b/poky/meta/lib/oeqa/utils/qemurunner.py
@@ -73,6 +73,8 @@ class QemuRunner:
self.monitorpipe = None
self.logger = logger
+ # Whether we're expecting an exit and should show related errors
+ self.canexit = False
# Enable testing other OS's
# Set commands for target communication, and default to Linux ALWAYS
@@ -275,14 +277,33 @@ class QemuRunner:
if self.runqemu_exited:
self.logger.warning("runqemu after timeout")
- return False
if self.runqemu.returncode:
self.logger.warning('runqemu exited with code %d' % self.runqemu.returncode)
- return False
if not self.is_alive():
- self.logger.warning('is_alive() failed later')
+ self.logger.error("Qemu pid didn't appear in %s seconds (%s)" %
+ (self.runqemutime, time.strftime("%D %H:%M:%S")))
+
+ qemu_pid = None
+ if os.path.isfile(self.qemu_pidfile):
+ with open(self.qemu_pidfile, 'r') as f:
+ qemu_pid = f.read().strip()
+
+ self.logger.error("Status information, poll status: %s, pidfile exists: %s, pidfile contents %s, proc pid exists %s"
+ % (self.runqemu.poll(), os.path.isfile(self.qemu_pidfile), str(qemu_pid), os.path.exists("/proc/" + str(qemu_pid))))
+
+ # Dump all processes to help us to figure out what is going on...
+ ps = subprocess.Popen(['ps', 'axww', '-o', 'pid,ppid,pri,ni,command '], stdout=subprocess.PIPE).communicate()[0]
+ processes = ps.decode("utf-8")
+ self.logger.debug("Running processes:\n%s" % processes)
+ self._dump_host()
+ op = self.getOutput(output)
+ self.stop()
+ if op:
+ self.logger.error("Output from runqemu:\n%s" % op)
+ else:
+ self.logger.error("No output from runqemu.\n")
return False
# Create the client socket for the QEMU Monitor Control Socket
@@ -324,31 +345,6 @@ class QemuRunner:
# Release the qemu porcess to continue running
self.run_monitor('cont')
- if not self.is_alive():
- self.logger.error("Qemu pid didn't appear in %s seconds (%s)" %
- (self.runqemutime, time.strftime("%D %H:%M:%S")))
-
- qemu_pid = None
- if os.path.isfile(self.qemu_pidfile):
- with open(self.qemu_pidfile, 'r') as f:
- qemu_pid = f.read().strip()
-
- self.logger.error("Status information, poll status: %s, pidfile exists: %s, pidfile contents %s, proc pid exists %s"
- % (self.runqemu.poll(), os.path.isfile(self.qemu_pidfile), str(qemu_pid), os.path.exists("/proc/" + str(qemu_pid))))
-
- # Dump all processes to help us to figure out what is going on...
- ps = subprocess.Popen(['ps', 'axww', '-o', 'pid,ppid,pri,ni,command '], stdout=subprocess.PIPE).communicate()[0]
- processes = ps.decode("utf-8")
- self.logger.debug("Running processes:\n%s" % processes)
- self._dump_host()
- op = self.getOutput(output)
- self.stop()
- if op:
- self.logger.error("Output from runqemu:\n%s" % op)
- else:
- self.logger.error("No output from runqemu.\n")
- return False
-
# We are alive: qemu is running
out = self.getOutput(output)
netconf = False # network configuration is not required by default
@@ -543,6 +539,7 @@ class QemuRunner:
self.thread.join()
def allowexit(self):
+ self.canexit = True
if self.thread:
self.thread.allowexit()
@@ -604,7 +601,9 @@ class QemuRunner:
if re.search(self.boot_patterns['search_cmd_finished'], data):
break
else:
- raise Exception("No data on serial console socket")
+ if self.canexit:
+ return (1, "")
+ raise Exception("No data on serial console socket, connection closed?")
if data:
if raw:
@@ -724,7 +723,7 @@ class LoggingThread(threading.Thread):
data = self.readsock.recv(count)
except socket.error as e:
if e.errno == errno.EAGAIN or e.errno == errno.EWOULDBLOCK:
- return ''
+ return b''
else:
raise
@@ -737,7 +736,7 @@ class LoggingThread(threading.Thread):
# until qemu exits.
if not self.canexit:
raise Exception("Console connection closed unexpectedly")
- return ''
+ return b''
return data