mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00
oeqa/core/target/qemu.py: display contents of dumped files
During do_testimage, if the target is not started within a certain timeout, TEST_QEMUBOOT_TIMEOUT, host data is dumped to files for each command in ${TMPDIR}/log/runtime-hostdump/<datetime>_qemu/host_<seq>_<command>. Display the first 20 lines of top output and the last 20 lines of bootlog to standard output for more context for the target not being started up. (From OE-Core rev: 441390b707bf681bc308c9ebd45ea2ae20c37d7c) Signed-off-by: Sakib Sajal <sakib.sajal@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
a71c3b390d
commit
b44849c32c
|
@ -8,6 +8,8 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import signal
|
import signal
|
||||||
import time
|
import time
|
||||||
|
import glob
|
||||||
|
import subprocess
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
from .ssh import OESSHTarget
|
from .ssh import OESSHTarget
|
||||||
|
@ -36,6 +38,8 @@ class OEQemuTarget(OESSHTarget):
|
||||||
self.ovmf = ovmf
|
self.ovmf = ovmf
|
||||||
self.use_slirp = slirp
|
self.use_slirp = slirp
|
||||||
self.boot_patterns = boot_patterns
|
self.boot_patterns = boot_patterns
|
||||||
|
self.dump_dir = dump_dir
|
||||||
|
self.bootlog = bootlog
|
||||||
|
|
||||||
self.runner = QemuRunner(machine=machine, rootfs=rootfs, tmpdir=tmpdir,
|
self.runner = QemuRunner(machine=machine, rootfs=rootfs, tmpdir=tmpdir,
|
||||||
deploy_dir_image=dir_image, display=display,
|
deploy_dir_image=dir_image, display=display,
|
||||||
|
@ -74,7 +78,28 @@ class OEQemuTarget(OESSHTarget):
|
||||||
self.server_ip = self.runner.server_ip
|
self.server_ip = self.runner.server_ip
|
||||||
else:
|
else:
|
||||||
self.stop()
|
self.stop()
|
||||||
raise RuntimeError("FAILED to start qemu - check the task log and the boot log")
|
# Display the first 20 lines of top and
|
||||||
|
# last 20 lines of the bootlog when the
|
||||||
|
# target is not being booted up.
|
||||||
|
topfile = glob.glob(self.dump_dir + "/*_qemu/host_*_top")
|
||||||
|
msg = "\n\n===== start: snippet =====\n\n"
|
||||||
|
for f in topfile:
|
||||||
|
msg += "file: %s\n\n" % f
|
||||||
|
with open(f) as tf:
|
||||||
|
for x in range(20):
|
||||||
|
msg += next(tf)
|
||||||
|
msg += "\n\n===== end: snippet =====\n\n"
|
||||||
|
blcmd = ["tail", "-20", self.bootlog]
|
||||||
|
msg += "===== start: snippet =====\n\n"
|
||||||
|
try:
|
||||||
|
out = subprocess.check_output(blcmd, stderr=subprocess.STDOUT, timeout=1).decode('utf-8')
|
||||||
|
msg += "file: %s\n\n" % self.bootlog
|
||||||
|
msg += out
|
||||||
|
except (subprocess.CalledProcessError, subprocess.TimeoutExpired, FileNotFoundError) as err:
|
||||||
|
msg += "Error running command: %s\n%s\n" % (blcmd, err)
|
||||||
|
msg += "\n\n===== end: snippet =====\n"
|
||||||
|
|
||||||
|
raise RuntimeError("FAILED to start qemu - check the task log and the boot log %s" % (msg))
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
self.runner.stop()
|
self.runner.stop()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user