summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/utils/qemurunner.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/utils/qemurunner.py')
-rw-r--r--meta/lib/oeqa/utils/qemurunner.py15
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
12import re 12import re
13import socket 13import socket
14import select 14import select
15import errno
15 16
16import logging 17import logging
17logger = logging.getLogger("BitBake.QemuRunner") 18logger = logging.getLogger("BitBake.QemuRunner")
@@ -104,6 +105,14 @@ class QemuRunner:
104 logger.info("waiting at most %s seconds for qemu pid" % self.runqemutime) 105 logger.info("waiting at most %s seconds for qemu pid" % self.runqemutime)
105 endtime = time.time() + self.runqemutime 106 endtime = time.time() + self.runqemutime
106 while not self.is_alive() and time.time() < endtime: 107 while not self.is_alive() and time.time() < endtime:
108 if self.runqemu.poll():
109 if self.runqemu.returncode:
110 # No point waiting any longer
111 logger.info('runqemu exited with code %d' % self.runqemu.returncode)
112 output = self.runqemu.stdout
113 self.stop()
114 logger.info("Output from runqemu:\n%s" % output.read())
115 return False
107 time.sleep(1) 116 time.sleep(1)
108 117
109 if self.is_alive(): 118 if self.is_alive():
@@ -169,7 +178,11 @@ class QemuRunner:
169 178
170 if self.runqemu: 179 if self.runqemu:
171 logger.info("Sending SIGTERM to runqemu") 180 logger.info("Sending SIGTERM to runqemu")
172 os.killpg(self.runqemu.pid, signal.SIGTERM) 181 try:
182 os.killpg(self.runqemu.pid, signal.SIGTERM)
183 except OSError as e:
184 if e.errno != errno.ESRCH:
185 raise
173 endtime = time.time() + self.runqemutime 186 endtime = time.time() + self.runqemutime
174 while self.runqemu.poll() is None and time.time() < endtime: 187 while self.runqemu.poll() is None and time.time() < endtime:
175 time.sleep(1) 188 time.sleep(1)