summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/utils/qemurunner.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/utils/qemurunner.py')
-rw-r--r--meta/lib/oeqa/utils/qemurunner.py18
1 files changed, 2 insertions, 16 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 49c70727a2..2ba0596ba1 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -21,7 +21,6 @@ import threading
21import codecs 21import codecs
22import logging 22import logging
23import tempfile 23import tempfile
24from oeqa.utils.dump import HostDumper
25from collections import defaultdict 24from collections import defaultdict
26import importlib 25import importlib
27 26
@@ -33,8 +32,8 @@ re_control_char = re.compile('[%s]' % re.escape("".join(control_chars)))
33 32
34class QemuRunner: 33class QemuRunner:
35 34
36 def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, boottime, dump_dir, dump_host_cmds, 35 def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, boottime, dump_dir, use_kvm, logger, use_slirp=False,
37 use_kvm, logger, use_slirp=False, serial_ports=2, boot_patterns = defaultdict(str), use_ovmf=False, workdir=None, tmpfsdir=None): 36 serial_ports=2, boot_patterns = defaultdict(str), use_ovmf=False, workdir=None, tmpfsdir=None):
38 37
39 # Popen object for runqemu 38 # Popen object for runqemu
40 self.runqemu = None 39 self.runqemu = None
@@ -69,7 +68,6 @@ class QemuRunner:
69 if not workdir: 68 if not workdir:
70 workdir = os.getcwd() 69 workdir = os.getcwd()
71 self.qemu_pidfile = workdir + '/pidfile_' + str(os.getpid()) 70 self.qemu_pidfile = workdir + '/pidfile_' + str(os.getpid())
72 self.host_dumper = HostDumper(dump_host_cmds, dump_dir)
73 self.monitorpipe = None 71 self.monitorpipe = None
74 72
75 self.logger = logger 73 self.logger = logger
@@ -138,7 +136,6 @@ class QemuRunner:
138 self.logger.error('runqemu exited with code %d' % self.runqemu.returncode) 136 self.logger.error('runqemu exited with code %d' % self.runqemu.returncode)
139 self.logger.error('Output from runqemu:\n%s' % self.getOutput(self.runqemu.stdout)) 137 self.logger.error('Output from runqemu:\n%s' % self.getOutput(self.runqemu.stdout))
140 self.stop() 138 self.stop()
141 self._dump_host()
142 139
143 def start(self, qemuparams = None, get_ip = True, extra_bootparams = None, runqemuparams='', launch_cmd=None, discard_writes=True): 140 def start(self, qemuparams = None, get_ip = True, extra_bootparams = None, runqemuparams='', launch_cmd=None, discard_writes=True):
144 env = os.environ.copy() 141 env = os.environ.copy()
@@ -286,7 +283,6 @@ class QemuRunner:
286 if self.runqemu.returncode: 283 if self.runqemu.returncode:
287 # No point waiting any longer 284 # No point waiting any longer
288 self.logger.warning('runqemu exited with code %d' % self.runqemu.returncode) 285 self.logger.warning('runqemu exited with code %d' % self.runqemu.returncode)
289 self._dump_host()
290 self.logger.warning("Output from runqemu:\n%s" % self.getOutput(output)) 286 self.logger.warning("Output from runqemu:\n%s" % self.getOutput(output))
291 self.stop() 287 self.stop()
292 return False 288 return False
@@ -314,7 +310,6 @@ class QemuRunner:
314 ps = subprocess.Popen(['ps', 'axww', '-o', 'pid,ppid,pri,ni,command '], stdout=subprocess.PIPE).communicate()[0] 310 ps = subprocess.Popen(['ps', 'axww', '-o', 'pid,ppid,pri,ni,command '], stdout=subprocess.PIPE).communicate()[0]
315 processes = ps.decode("utf-8") 311 processes = ps.decode("utf-8")
316 self.logger.debug("Running processes:\n%s" % processes) 312 self.logger.debug("Running processes:\n%s" % processes)
317 self._dump_host()
318 op = self.getOutput(output) 313 op = self.getOutput(output)
319 self.stop() 314 self.stop()
320 if op: 315 if op:
@@ -430,7 +425,6 @@ class QemuRunner:
430 self.logger.error("Couldn't get ip from qemu command line and runqemu output! " 425 self.logger.error("Couldn't get ip from qemu command line and runqemu output! "
431 "Here is the qemu command line used:\n%s\n" 426 "Here is the qemu command line used:\n%s\n"
432 "and output from runqemu:\n%s" % (cmdline, out)) 427 "and output from runqemu:\n%s" % (cmdline, out))
433 self._dump_host()
434 self.stop() 428 self.stop()
435 return False 429 return False
436 430
@@ -508,7 +502,6 @@ class QemuRunner:
508 lines = tail(bootlog if bootlog else self.msg) 502 lines = tail(bootlog if bootlog else self.msg)
509 self.logger.warning("Last 25 lines of text (%d):\n%s" % (len(bootlog), lines)) 503 self.logger.warning("Last 25 lines of text (%d):\n%s" % (len(bootlog), lines))
510 self.logger.warning("Check full boot log: %s" % self.logfile) 504 self.logger.warning("Check full boot log: %s" % self.logfile)
511 self._dump_host()
512 self.stop() 505 self.stop()
513 return False 506 return False
514 507
@@ -689,13 +682,6 @@ class QemuRunner:
689 status = 1 682 status = 1
690 return (status, str(data)) 683 return (status, str(data))
691 684
692
693 def _dump_host(self):
694 self.host_dumper.create_dir("qemu")
695 self.logger.warning("Qemu ended unexpectedly, dump data from host"
696 " is in %s" % self.host_dumper.dump_dir)
697 self.host_dumper.dump_host()
698
699# This class is for reading data from a socket and passing it to logfunc 685# This class is for reading data from a socket and passing it to logfunc
700# to be processed. It's completely event driven and has a straightforward 686# to be processed. It's completely event driven and has a straightforward
701# event loop. The mechanism for stopping the thread is a simple pipe which 687# event loop. The mechanism for stopping the thread is a simple pipe which