aboutsummaryrefslogtreecommitdiffstats
path: root/lib/oeqa/utils/qemuzephyrrunner.py
diff options
context:
space:
mode:
authorJuro Bystricky <juro.bystricky@intel.com>2016-12-28 09:34:17 -0800
committerJuro Bystricky <juro.bystricky@intel.com>2017-01-04 11:10:25 -0800
commit97643716c2682a15c58377d99d49e7a2e60a660a (patch)
treeafe93bdd05bea429a9cd479745e92ce725036c25 /lib/oeqa/utils/qemuzephyrrunner.py
parent7a8d7eb97e1683cbefbd62919d78d0b0b2775cab (diff)
downloadmeta-zephyr-97643716c2682a15c58377d99d49e7a2e60a660a.tar.gz
meta-zephyr-97643716c2682a15c58377d99d49e7a2e60a660a.tar.bz2
meta-zephyr-97643716c2682a15c58377d99d49e7a2e60a660a.zip
meta-zephyr: basic upgrade
Numerous changes to allow building and running various Zephyr tests using Zephyr release 1.6 and Yocto master distro (commit 3676601335b4673e3572d5a9987a351f0bb44bcb and later) Work in progress. Notable changes: 1. Zephyr 1.6 does not support the concept of nano and micro kernel anymore. 2. Location of various tests have changed 3. Changes due to subtle python3/python2 differences 4. Zephyr Makefile changes (including renaming) 5. Improved failed test detection 6. Remove patch files no longer needed With these changes, it is now possible to run Zephyr test suite and Zephyr sample programs. Currently only x86 CPUs are supported, with additional CPU support coming in the near future, in particular support for ARM Cortex-M3 CPUs Prerequisites: Modify local conf by adding: DISTRO="zephyr" MACHINE?="qemux86" Modify bblayers.conf by adding "meta-zephyr" to BBLAYERS To build all Zephyr tests: $ bitbake zephyr-kernel-test-all To test all built test images: $ bitbake zephyr-kernel-test-all -ctestimage You can also build and test an individual test. This is done by appending the actual test name to the "zephyr-kernel-test", for example: $ bitbake zephyr-kernel-test-test_sleep $ bitbake zephyr-kernel-test-test_sleep -ctestimage It is also possible to build Zephyr sample programs. Included is a sample recipe that builds the Zephyr "philosophers" sample: $ bitbake zephyr-philosophers Once built, you can run the created "philosophers" image in qemu (at this point the various paths have to be entered manually): $ ./tmp/sysroots/x86_64-linux/usr/bin/qemu-system-i386 \ -kernel ./tmp/deploy/images/qemux86/philosophers.elf \ -nographic -machine type=pc-0.14 -display none -clock dynticks \ -no-acpi -balloon none Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Diffstat (limited to 'lib/oeqa/utils/qemuzephyrrunner.py')
-rw-r--r--lib/oeqa/utils/qemuzephyrrunner.py41
1 files changed, 20 insertions, 21 deletions
diff --git a/lib/oeqa/utils/qemuzephyrrunner.py b/lib/oeqa/utils/qemuzephyrrunner.py
index 8021a22..52939b5 100644
--- a/lib/oeqa/utils/qemuzephyrrunner.py
+++ b/lib/oeqa/utils/qemuzephyrrunner.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2015 Intel Corporation
+# Copyright (C) 2015-2016 Intel Corporation
#
# Released under the MIT license (see COPYING.MIT)
@@ -13,35 +13,43 @@ import socket
import select
import bb
import tempfile
-from qemurunner import QemuRunner
+from oeqa.utils.qemurunner import QemuRunner
class QemuZephyrRunner(QemuRunner):
def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, kernel, boottime):
QemuRunner.__init__(self, machine, rootfs, display, tmpdir,
deploy_dir_image, logfile, boottime, None,
- None)
+ None, True)
# Popen object for runqemu
self.socketfile = tempfile.NamedTemporaryFile()
+ self.runqemu = None
self.socketname = self.socketfile.name
self.server_socket = None
self.kernel = kernel
def create_socket(self):
- tries = 3
+ bb.note("waiting at most %s seconds for qemu pid" % self.runqemutime)
+ tries = self.runqemutime
while tries > 0:
+ time.sleep(1)
try:
self.server_socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
self.server_socket.connect(self.socketname)
bb.note("Created listening socket for qemu serial console.")
- tries = 0
- except socket.error, msg:
+ break
+
+ except socket.error:
self.server_socket.close()
- bb.error("Failed to create listening socket %s: %s" % (self.socketname, msg))
tries -= 1
- def start(self, qemuparams = None):
+ if tries == 0:
+ bb.error("Failed to create listening socket %s: " % (self.socketname))
+ return False
+ return True
+
+ def start(self, qemuparams = None, get_ip = True, extra_bootparams = None):
if not os.path.exists(self.tmpdir):
bb.error("Invalid TMPDIR path %s" % self.tmpdir)
@@ -75,12 +83,12 @@ class QemuZephyrRunner(QemuRunner):
self.runqemu = subprocess.Popen(launch_cmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,preexec_fn=os.setpgrp)
#
- # We need the preexec_fn above so that all runqemu processes can easily be killed
+ # We need the preexec_fn above so that all runqemu processes can easily be killed
# (by killing their process group). This presents a problem if this controlling
- # process itself is killed however since those processes don't notice the death
+ # process itself is killed however since those processes don't notice the death
# of the parent and merrily continue on.
#
- # Rather than hack runqemu to deal with this, we add something here instead.
+ # Rather than hack runqemu to deal with this, we add something here instead.
# Basically we fork off another process which holds an open pipe to the parent
# and also is setpgrp. If/when the pipe sees EOF from the parent dieing, it kills
# the process group. This is like pctrl's PDEATHSIG but for a process group
@@ -101,16 +109,7 @@ class QemuZephyrRunner(QemuRunner):
sys.exit(0)
bb.note("qemu started, pid is %s" % self.runqemu.pid)
- #Hack to wait for socket to show up because I'm tired
- time.sleep(5)
- self.create_socket()
-
- return True
-
- def is_alive(self):
- if not self.runqemu:
- return False
- return True
+ return self.create_socket()
def wait_for_serial(self, func_timeout, data_timeout):
stopread = False