Richard Purdie 66f536ad57 oeqa: Clean up logger handling
The logger handling in oeqa was confused at best. This patch:

a) Passes in a logger through various qemu runner pieces
b) Uses that logger consistently in the code
c) Creates a logger for QemuRunner outside the bitbake namespace
   meaning we don't conflict with the tinfoil logging changes

The result of this is more consistency. For runtime tests in testimage,
the logs always contain the debug info, nothing is shwon on the console.
For the oe-selftests, logs are intercepted and only shown if the test
fails.

(From OE-Core rev: ba8babc45141891d0624f9a181a580fa416e87ec)

(From OE-Core rev: 22003f97ff7f53c32999dc466d26c1471ead9b6b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster@mvista.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-04 11:11:59 +00:00

46 lines
1.6 KiB
Python

# Copyright (C) 2016 Intel Corporation
# Released under the MIT license (see COPYING.MIT)
import os
import sys
import signal
import time
from .ssh import OESSHTarget
from oeqa.utils.qemurunner import QemuRunner
supported_fstypes = ['ext3', 'ext4', 'cpio.gz', 'wic', 'elf']
class OEQemuTarget(OESSHTarget):
def __init__(self, logger, ip, server_ip, timeout=300, user='root',
port=None, machine='', rootfs='', kernel='', kvm=False,
dump_dir='', dump_host_cmds='', display='', bootlog='',
tmpdir='', dir_image='', boottime=60, **kwargs):
super(OEQemuTarget, self).__init__(logger, ip, server_ip, timeout,
user, port)
self.ip = ip
self.server_ip = server_ip
self.machine = machine
self.rootfs = rootfs
self.kernel = kernel
self.kvm = kvm
self.runner = QemuRunner(machine=machine, rootfs=rootfs, tmpdir=tmpdir,
deploy_dir_image=dir_image, display=display,
logfile=bootlog, boottime=boottime,
use_kvm=kvm, dump_dir=dump_dir,
dump_host_cmds=dump_host_cmds, logger=logger)
def start(self, params=None, extra_bootparams=None):
if self.runner.start(params, extra_bootparams=extra_bootparams):
self.ip = self.runner.ip
self.server_ip = self.runner.server_ip
else:
self.stop()
raise RuntimeError("FAILED to start qemu - check the task log and the boot log")
def stop(self):
self.runner.stop()