mirror of
git://git.yoctoproject.org/poky
synced 2026-08-12 19:14:28 +00:00
oeqa/qemurunner: Clean up failure handling
If you fail to setup the tap devices, runqemu will error quickly however stdout/stderr are not shown to the user, instead a SystemExit traceback is shown. This could explain some long since unexplained failures on the autobuilder. Rework the error handling so SystemExit isn't used and the standard log failure messages can be shown. The code could likely ultimatley need some restructuring to work effectively. (From OE-Core rev: 83b8e66b66aa9848ed9c8761a21cb47c6443d0c6) (From OE-Core rev: 19120fce4f55f6a2903812ed9461273a85cb3544) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit e820c86fb9ddfadea0c27f29e14b985ee3178320) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
c77dade37c
commit
6dc7ae4ff9
@ -35,6 +35,7 @@ class QemuRunner:
|
||||
|
||||
# Popen object for runqemu
|
||||
self.runqemu = None
|
||||
self.runqemu_exited = False
|
||||
# pid of the qemu process that runqemu will start
|
||||
self.qemupid = None
|
||||
# target ip - from the command line or runqemu output
|
||||
@ -102,7 +103,6 @@ class QemuRunner:
|
||||
self.logger.debug("Output from runqemu:\n%s" % self.getOutput(self.runqemu.stdout))
|
||||
self.stop()
|
||||
self._dump_host()
|
||||
raise SystemExit
|
||||
|
||||
def start(self, qemuparams = None, get_ip = True, extra_bootparams = None, runqemuparams='', launch_cmd=None, discard_writes=True):
|
||||
env = os.environ.copy()
|
||||
@ -206,6 +206,8 @@ class QemuRunner:
|
||||
endtime = time.time() + self.runqemutime
|
||||
while not self.is_alive() and time.time() < endtime:
|
||||
if self.runqemu.poll():
|
||||
if self.runqemu_exited:
|
||||
return False
|
||||
if self.runqemu.returncode:
|
||||
# No point waiting any longer
|
||||
self.logger.warning('runqemu exited with code %d' % self.runqemu.returncode)
|
||||
@ -215,6 +217,9 @@ class QemuRunner:
|
||||
return False
|
||||
time.sleep(0.5)
|
||||
|
||||
if self.runqemu_exited:
|
||||
return False
|
||||
|
||||
if not self.is_alive():
|
||||
self.logger.error("Qemu pid didn't appear in %s seconds (%s)" %
|
||||
(self.runqemutime, time.strftime("%D %H:%M:%S")))
|
||||
@ -385,7 +390,7 @@ class QemuRunner:
|
||||
os.killpg(os.getpgid(self.runqemu.pid), signal.SIGKILL)
|
||||
self.runqemu.stdin.close()
|
||||
self.runqemu.stdout.close()
|
||||
self.runqemu = None
|
||||
self.runqemu_exited = True
|
||||
|
||||
if hasattr(self, 'server_socket') and self.server_socket:
|
||||
self.server_socket.close()
|
||||
@ -425,7 +430,7 @@ class QemuRunner:
|
||||
return False
|
||||
|
||||
def is_alive(self):
|
||||
if not self.runqemu or self.runqemu.poll() is not None:
|
||||
if not self.runqemu or self.runqemu.poll() is not None or self.runqemu_exited:
|
||||
return False
|
||||
if os.path.isfile(self.qemu_pidfile):
|
||||
# when handling pidfile, qemu creates the file, stat it, lock it and then write to it
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user