summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-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")