summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorYeoh Ee Peng <ee.peng.yeoh@intel.com>2018-11-22 17:10:44 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-11-22 12:19:26 +0000
commit1db6a6fc9cde28d0a29bcf6d24a8bfbe51d120b1 (patch)
tree0ecb4f513f741e82365d5e3957e48ac4f775ed02 /meta/lib
parent14d99dc6c39c963ba3e0d9a30274846bd5369210 (diff)
downloadopenembedded-core-contrib-1db6a6fc9cde28d0a29bcf6d24a8bfbe51d120b1.tar.gz
openembedded-core-contrib-1db6a6fc9cde28d0a29bcf6d24a8bfbe51d120b1.tar.bz2
openembedded-core-contrib-1db6a6fc9cde28d0a29bcf6d24a8bfbe51d120b1.zip
qemurunner: Add support for slirp
Enable qemurunner for slirp. Retrieved the ip & port from host machine to connect to qemu from host machine. [YOCTO#10713] 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')
-rw-r--r--meta/lib/oeqa/utils/qemurunner.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index d40b3b808b..f943034092 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -28,7 +28,8 @@ re_control_char = re.compile('[%s]' % re.escape("".join(control_chars)))
class QemuRunner:
- def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, boottime, dump_dir, dump_host_cmds, use_kvm, logger):
+ def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, boottime, dump_dir, dump_host_cmds,
+ use_kvm, logger, use_slirp=False):
# Popen object for runqemu
self.runqemu = None
@@ -51,6 +52,7 @@ class QemuRunner:
self.logged = False
self.thread = None
self.use_kvm = use_kvm
+ self.use_slirp = use_slirp
self.msg = ''
self.runqemutime = 120
@@ -129,6 +131,8 @@ class QemuRunner:
self.logger.debug('Not using kvm for runqemu')
if not self.display:
launch_cmd += ' nographic'
+ if self.use_slirp:
+ launch_cmd += ' slirp'
launch_cmd += ' %s %s' % (self.machine, self.rootfs)
return self.launch(launch_cmd, qemuparams=qemuparams, get_ip=get_ip, extra_bootparams=extra_bootparams, env=env)
@@ -238,9 +242,14 @@ class QemuRunner:
# because is possible to have control characters
cmdline = re_control_char.sub(' ', cmdline)
try:
- ips = re.findall(r"((?:[0-9]{1,3}\.){3}[0-9]{1,3})", cmdline.split("ip=")[1])
- self.ip = ips[0]
- self.server_ip = ips[1]
+ if self.use_slirp:
+ tcp_ports = cmdline.split("hostfwd=tcp::")[1]
+ host_port = tcp_ports[:tcp_ports.find('-')]
+ self.ip = "localhost:%s" % host_port
+ else:
+ ips = re.findall(r"((?:[0-9]{1,3}\.){3}[0-9]{1,3})", cmdline.split("ip=")[1])
+ self.ip = ips[0]
+ self.server_ip = ips[1]
self.logger.debug("qemu cmdline used:\n{}".format(cmdline))
except (IndexError, ValueError):
# Try to get network configuration from runqemu output