diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2015-07-27 14:04:00 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-07-27 23:28:20 +0100 |
commit | 1789b89de6c4642464abadd9f8a4746385e6b4a7 (patch) | |
tree | 5dbd3d69134d51b82905a69b1a863d7a7da1cc9a | |
parent | a058d07cd7251749fa9c1c8eca3caa80144664fe (diff) | |
download | openembedded-core-1789b89de6c4642464abadd9f8a4746385e6b4a7.tar.gz openembedded-core-1789b89de6c4642464abadd9f8a4746385e6b4a7.tar.bz2 openembedded-core-1789b89de6c4642464abadd9f8a4746385e6b4a7.zip |
oeqa/utils/qemurunner: fix error handling if runqemu exits with an error
* Don't wait for QEMU to start if it's never going to (because runqemu
exited with an error)
* Don't error out if killing the process fails with "no such process"
(we don't care if it's already dead)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/lib/oeqa/utils/qemurunner.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py index 11186d6b26..71da21c779 100644 --- a/meta/lib/oeqa/utils/qemurunner.py +++ b/meta/lib/oeqa/utils/qemurunner.py @@ -12,6 +12,7 @@ import signal import re import socket import select +import errno import logging logger = logging.getLogger("BitBake.QemuRunner") @@ -104,6 +105,14 @@ class QemuRunner: logger.info("waiting at most %s seconds for qemu pid" % self.runqemutime) endtime = time.time() + self.runqemutime while not self.is_alive() and time.time() < endtime: + if self.runqemu.poll(): + if self.runqemu.returncode: + # No point waiting any longer + logger.info('runqemu exited with code %d' % self.runqemu.returncode) + output = self.runqemu.stdout + self.stop() + logger.info("Output from runqemu:\n%s" % output.read()) + return False time.sleep(1) if self.is_alive(): @@ -169,7 +178,11 @@ class QemuRunner: if self.runqemu: logger.info("Sending SIGTERM to runqemu") - os.killpg(self.runqemu.pid, signal.SIGTERM) + try: + os.killpg(self.runqemu.pid, signal.SIGTERM) + except OSError as e: + if e.errno != errno.ESRCH: + raise endtime = time.time() + self.runqemutime while self.runqemu.poll() is None and time.time() < endtime: time.sleep(1) |