diff options
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/utils/qemurunner.py | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py index def8acedcb..784cf964f5 100644 --- a/meta/lib/oeqa/utils/qemurunner.py +++ b/meta/lib/oeqa/utils/qemurunner.py | |||
@@ -91,7 +91,7 @@ class QemuRunner: | |||
91 | self._dump_host() | 91 | self._dump_host() |
92 | raise SystemExit | 92 | raise SystemExit |
93 | 93 | ||
94 | def start(self, qemuparams = None): | 94 | def start(self, qemuparams = None, get_ip = True): |
95 | if self.display: | 95 | if self.display: |
96 | os.environ["DISPLAY"] = self.display | 96 | os.environ["DISPLAY"] = self.display |
97 | # Set this flag so that Qemu doesn't do any grabs as SDL grabs | 97 | # Set this flag so that Qemu doesn't do any grabs as SDL grabs |
@@ -178,27 +178,28 @@ class QemuRunner: | |||
178 | 178 | ||
179 | if self.is_alive(): | 179 | if self.is_alive(): |
180 | logger.info("qemu started - qemu procces pid is %s" % self.qemupid) | 180 | logger.info("qemu started - qemu procces pid is %s" % self.qemupid) |
181 | cmdline = '' | 181 | if get_ip: |
182 | with open('/proc/%s/cmdline' % self.qemupid) as p: | 182 | cmdline = '' |
183 | cmdline = p.read() | 183 | with open('/proc/%s/cmdline' % self.qemupid) as p: |
184 | # It is needed to sanitize the data received | 184 | cmdline = p.read() |
185 | # because is possible to have control characters | 185 | # It is needed to sanitize the data received |
186 | cmdline = re_control_char.sub('', cmdline) | 186 | # because is possible to have control characters |
187 | try: | 187 | cmdline = re_control_char.sub('', cmdline) |
188 | ips = re.findall("((?:[0-9]{1,3}\.){3}[0-9]{1,3})", cmdline.split("ip=")[1]) | 188 | try: |
189 | if not ips or len(ips) != 3: | 189 | ips = re.findall("((?:[0-9]{1,3}\.){3}[0-9]{1,3})", cmdline.split("ip=")[1]) |
190 | raise ValueError | 190 | if not ips or len(ips) != 3: |
191 | else: | 191 | raise ValueError |
192 | self.ip = ips[0] | 192 | else: |
193 | self.server_ip = ips[1] | 193 | self.ip = ips[0] |
194 | except IndexError, ValueError: | 194 | self.server_ip = ips[1] |
195 | logger.info("Couldn't get ip from qemu process arguments! Here is the qemu command line used:\n%s\nand output from runqemu:\n%s" % (cmdline, self.getOutput(output))) | 195 | except IndexError, ValueError: |
196 | self._dump_host() | 196 | logger.info("Couldn't get ip from qemu process arguments! Here is the qemu command line used:\n%s\nand output from runqemu:\n%s" % (cmdline, self.getOutput(output))) |
197 | self.stop() | 197 | self._dump_host() |
198 | return False | 198 | self.stop() |
199 | logger.info("qemu cmdline used:\n{}".format(cmdline)) | 199 | return False |
200 | logger.info("Target IP: %s" % self.ip) | 200 | logger.info("qemu cmdline used:\n{}".format(cmdline)) |
201 | logger.info("Server IP: %s" % self.server_ip) | 201 | logger.info("Target IP: %s" % self.ip) |
202 | logger.info("Server IP: %s" % self.server_ip) | ||
202 | 203 | ||
203 | self.thread = LoggingThread(self.log, threadsock, logger) | 204 | self.thread = LoggingThread(self.log, threadsock, logger) |
204 | self.thread.start() | 205 | self.thread.start() |