From 53ab41a5f6d20e911362a9261ae528452bb71bbd Mon Sep 17 00:00:00 2001 From: Mariano Lopez Date: Tue, 1 Sep 2015 07:36:29 +0000 Subject: qemurunner: Added host dumps when there are errors This adds an instance of HostDumper to qemurunner, with this instance now is possible to get dumps from the host when there is an error. This adds dump points in the next cases: - runqemu exits before seeing qemu pid - Fail to get qemu process arguments - Not reach login banner before timeout - qemu pid never appears This also modifies the constructors of BaseDumper, HostDumper and TargetDumper, they don't require the datastore anymore, but the feature to replace datastore variables has been lost (never used) [YOCTO #8118] (From OE-Core rev: b0af40fb76cd5035696e9d8a44f815f64214d23a) Signed-off-by: Mariano Lopez Signed-off-by: Richard Purdie --- meta/lib/oeqa/utils/qemurunner.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'meta/lib/oeqa/utils/qemurunner.py') diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py index bcdb69b38c..4ce5d9c685 100644 --- a/meta/lib/oeqa/utils/qemurunner.py +++ b/meta/lib/oeqa/utils/qemurunner.py @@ -14,13 +14,14 @@ import socket import select import errno import threading +from oeqa.utils.dump import HostDumper import logging logger = logging.getLogger("BitBake.QemuRunner") class QemuRunner: - def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, boottime): + def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, boottime, dump_dir, dump_host_cmds): # Popen object for runqemu self.runqemu = None @@ -42,6 +43,7 @@ class QemuRunner: self.thread = None self.runqemutime = 60 + self.host_dumper = HostDumper(dump_host_cmds, dump_dir) def create_socket(self): try: @@ -118,6 +120,7 @@ class QemuRunner: if self.runqemu.returncode: # No point waiting any longer logger.info('runqemu exited with code %d' % self.runqemu.returncode) + self._dump_host() self.stop() logger.info("Output from runqemu:\n%s" % getOutput(output)) return False @@ -137,6 +140,7 @@ class QemuRunner: self.server_ip = ips[1] except IndexError, ValueError: 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._dump_host() self.stop() return False logger.info("qemu cmdline used:\n{}".format(cmdline)) @@ -189,6 +193,7 @@ class QemuRunner: lines = "\n".join(bootlog.splitlines()[-25:]) logger.info("Last 25 lines of text:\n%s" % lines) logger.info("Check full boot log: %s" % self.logfile) + self._dump_host() self.stop() return False @@ -202,6 +207,7 @@ class QemuRunner: else: logger.info("Qemu pid didn't appeared in %s seconds" % self.runqemutime) + self._dump_host() self.stop() logger.info("Output from runqemu:\n%s" % getOutput(output)) return False @@ -334,6 +340,13 @@ class QemuRunner: status = 1 return (status, str(data)) + + def _dump_host(self): + self.host_dumper.create_dir("qemu") + logger.error("Qemu ended unexpectedly, dump data from host" + " is in %s" % self.host_dumper.dump_dir) + self.host_dumper.dump_host() + # This class is for reading data from a socket and passing it to logfunc # to be processed. It's completely event driven and has a straightforward # event loop. The mechanism for stopping the thread is a simple pipe which -- cgit v1.2.3-54-g00ecf