summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa
diff options
context:
space:
mode:
authorYeoh Ee Peng <ee.peng.yeoh@intel.com>2018-11-22 17:10:45 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-11-23 23:35:18 +0000
commit325ae1008c1ebe96a57965aa2e3129f536a9b64d (patch)
tree15df42d5e1a4f6a3f4644f3cb31285017bf18298 /meta/lib/oeqa
parentba9c6285c5fa480ddf9956ee45c922d035114503 (diff)
downloadpoky-325ae1008c1ebe96a57965aa2e3129f536a9b64d.tar.gz
oeqa/qemu: Add support for slirp
Enable qemu for slirp. Initialize Qemurunner with slirp. Setup ip and port attribute to enable connection with qemu running with slirp. [YOCTO#10713] (From OE-Core rev: 815e05ac4abb42238d6fdeb15d7426759e059ce1) Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r--meta/lib/oeqa/core/target/qemu.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/meta/lib/oeqa/core/target/qemu.py b/meta/lib/oeqa/core/target/qemu.py
index 538bf12b6a..f47fd7468e 100644
--- a/meta/lib/oeqa/core/target/qemu.py
+++ b/meta/lib/oeqa/core/target/qemu.py
@@ -13,7 +13,7 @@ supported_fstypes = ['ext3', 'ext4', 'cpio.gz', 'wic']
13 13
14class OEQemuTarget(OESSHTarget): 14class OEQemuTarget(OESSHTarget):
15 def __init__(self, logger, server_ip, timeout=300, user='root', 15 def __init__(self, logger, server_ip, timeout=300, user='root',
16 port=None, machine='', rootfs='', kernel='', kvm=False, 16 port=None, machine='', rootfs='', kernel='', kvm=False, slirp=False,
17 dump_dir='', dump_host_cmds='', display='', bootlog='', 17 dump_dir='', dump_host_cmds='', display='', bootlog='',
18 tmpdir='', dir_image='', boottime=60, **kwargs): 18 tmpdir='', dir_image='', boottime=60, **kwargs):
19 19
@@ -25,17 +25,33 @@ class OEQemuTarget(OESSHTarget):
25 self.rootfs = rootfs 25 self.rootfs = rootfs
26 self.kernel = kernel 26 self.kernel = kernel
27 self.kvm = kvm 27 self.kvm = kvm
28 self.use_slirp = slirp
28 29
29 self.runner = QemuRunner(machine=machine, rootfs=rootfs, tmpdir=tmpdir, 30 self.runner = QemuRunner(machine=machine, rootfs=rootfs, tmpdir=tmpdir,
30 deploy_dir_image=dir_image, display=display, 31 deploy_dir_image=dir_image, display=display,
31 logfile=bootlog, boottime=boottime, 32 logfile=bootlog, boottime=boottime,
32 use_kvm=kvm, dump_dir=dump_dir, 33 use_kvm=kvm, use_slirp=slirp, dump_dir=dump_dir,
33 dump_host_cmds=dump_host_cmds, logger=logger) 34 dump_host_cmds=dump_host_cmds, logger=logger)
34 35
35 def start(self, params=None, extra_bootparams=None): 36 def start(self, params=None, extra_bootparams=None):
37 if self.use_slirp and not self.server_ip:
38 self.logger.error("Could not start qemu with slirp without server ip - provide 'TEST_SERVER_IP'")
39 raise RuntimeError("FAILED to start qemu - check the task log and the boot log")
36 if self.runner.start(params, extra_bootparams=extra_bootparams): 40 if self.runner.start(params, extra_bootparams=extra_bootparams):
37 self.ip = self.runner.ip 41 self.ip = self.runner.ip
38 self.server_ip = self.runner.server_ip 42 if self.use_slirp:
43 target_ip_port = self.runner.ip.split(':')
44 if len(target_ip_port) == 2:
45 target_ip = target_ip_port[0]
46 port = target_ip_port[1]
47 self.ip = target_ip
48 self.ssh = self.ssh + ['-p', port]
49 self.scp = self.scp + ['-P', port]
50 else:
51 self.logger.error("Could not get host machine port to connect qemu with slirp, ssh will not be "
52 "able to connect to qemu with slirp")
53 if self.runner.server_ip:
54 self.server_ip = self.runner.server_ip
39 else: 55 else:
40 self.stop() 56 self.stop()
41 raise RuntimeError("FAILED to start qemu - check the task log and the boot log") 57 raise RuntimeError("FAILED to start qemu - check the task log and the boot log")