summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/utils/qemurunner.py31
1 files changed, 18 insertions, 13 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index fc2e244a7f..3e604d8155 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -177,7 +177,7 @@ class QemuRunner:
177 self.stop() 177 self.stop()
178 return False 178 return False
179 179
180 (status, output) = self.run_serial("root\n") 180 (status, output) = self.run_serial("root\n", raw=True)
181 if re.search("root@[a-zA-Z0-9\-]+:~#", output): 181 if re.search("root@[a-zA-Z0-9\-]+:~#", output):
182 self.logged = True 182 self.logged = True
183 logger.info("Logged as root in serial console") 183 logger.info("Logged as root in serial console")
@@ -274,9 +274,11 @@ class QemuRunner:
274 if "qemu-system" in basecmd and "-serial tcp" in commands[p]: 274 if "qemu-system" in basecmd and "-serial tcp" in commands[p]:
275 return [int(p),commands[p]] 275 return [int(p),commands[p]]
276 276
277 def run_serial(self, command): 277 def run_serial(self, command, raw=False):
278 # We assume target system have echo to get command status 278 # We assume target system have echo to get command status
279 self.server_socket.sendall("%s; echo $?\n" % command) 279 if not raw:
280 command = "%s; echo $?\n" % command
281 self.server_socket.sendall(command)
280 data = '' 282 data = ''
281 status = 0 283 status = 0
282 stopread = False 284 stopread = False
@@ -291,15 +293,18 @@ class QemuRunner:
291 sock.close() 293 sock.close()
292 stopread = True 294 stopread = True
293 if data: 295 if data:
294 # Remove first line (command line) and last line (prompt) 296 if raw:
295 data = data[data.find('$?\r\n')+4:data.rfind('\r\n')]
296 index = data.rfind('\r\n')
297 if index == -1:
298 status_cmd = data
299 data = ""
300 else:
301 status_cmd = data[index+2:]
302 data = data[:index]
303 if (status_cmd == "0"):
304 status = 1 297 status = 1
298 else:
299 # Remove first line (command line) and last line (prompt)
300 data = data[data.find('$?\r\n')+4:data.rfind('\r\n')]
301 index = data.rfind('\r\n')
302 if index == -1:
303 status_cmd = data
304 data = ""
305 else:
306 status_cmd = data[index+2:]
307 data = data[:index]
308 if (status_cmd == "0"):
309 status = 1
305 return (status, str(data)) 310 return (status, str(data))