poky/meta/lib/oeqa/core/target/qemu.py
Richard Purdie ffae400179 meta/lib+scripts: Convert to SPDX license headers
This adds SPDX license headers in place of the wide assortment of things
currently in our script headers. We default to GPL-2.0-only except for the
oeqa code where it was clearly submitted and marked as MIT on the most part
or some scripts which had the "or later" GPL versioning.

The patch also drops other obsolete bits of file headers where they were
encoountered such as editor modelines, obsolete maintainer information or
the phrase "All rights reserved" which is now obsolete and not required in
copyright headers (in this case its actually confusing for licensing as all
rights were not reserved).

More work is needed for OE-Core but this takes care of the bulk of the scripts
and meta/lib directories.

The top level LICENSE files are tweaked to match the new structure and the
SPDX naming.

(From OE-Core rev: f8c9c511b5f1b7dbd45b77f345cb6c048ae6763e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-09 16:31:55 +01:00

64 lines
2.5 KiB
Python

#
# Copyright (C) 2016 Intel Corporation
#
# SPDX-License-Identifier: 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']
class OEQemuTarget(OESSHTarget):
def __init__(self, logger, server_ip, timeout=300, user='root',
port=None, machine='', rootfs='', kernel='', kvm=False, slirp=False,
dump_dir='', dump_host_cmds='', display='', bootlog='',
tmpdir='', dir_image='', boottime=60, **kwargs):
super(OEQemuTarget, self).__init__(logger, None, server_ip, timeout,
user, port)
self.server_ip = server_ip
self.machine = machine
self.rootfs = rootfs
self.kernel = kernel
self.kvm = kvm
self.use_slirp = slirp
self.runner = QemuRunner(machine=machine, rootfs=rootfs, tmpdir=tmpdir,
deploy_dir_image=dir_image, display=display,
logfile=bootlog, boottime=boottime,
use_kvm=kvm, use_slirp=slirp, dump_dir=dump_dir,
dump_host_cmds=dump_host_cmds, logger=logger)
def start(self, params=None, extra_bootparams=None, runqemuparams=''):
if self.use_slirp and not self.server_ip:
self.logger.error("Could not start qemu with slirp without server ip - provide 'TEST_SERVER_IP'")
raise RuntimeError("FAILED to start qemu - check the task log and the boot log")
if self.runner.start(params, extra_bootparams=extra_bootparams, runqemuparams=runqemuparams):
self.ip = self.runner.ip
if self.use_slirp:
target_ip_port = self.runner.ip.split(':')
if len(target_ip_port) == 2:
target_ip = target_ip_port[0]
port = target_ip_port[1]
self.ip = target_ip
self.ssh = self.ssh + ['-p', port]
self.scp = self.scp + ['-P', port]
else:
self.logger.error("Could not get host machine port to connect qemu with slirp, ssh will not be "
"able to connect to qemu with slirp")
if self.runner.server_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()