diff options
Diffstat (limited to 'meta/lib/oeqa/utils/qemurunner.py')
| -rw-r--r-- | meta/lib/oeqa/utils/qemurunner.py | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py index 695402fead..f51de99458 100644 --- a/meta/lib/oeqa/utils/qemurunner.py +++ b/meta/lib/oeqa/utils/qemurunner.py | |||
| @@ -71,7 +71,8 @@ class QemuRunner: | |||
| 71 | if self.logfile: | 71 | if self.logfile: |
| 72 | # It is needed to sanitize the data received from qemu | 72 | # It is needed to sanitize the data received from qemu |
| 73 | # because is possible to have control characters | 73 | # because is possible to have control characters |
| 74 | msg = re_control_char.sub('', unicode(msg, 'utf-8')) | 74 | msg = msg.decode("utf-8") |
| 75 | msg = re_control_char.sub('', msg) | ||
| 75 | with codecs.open(self.logfile, "a", encoding="utf-8") as f: | 76 | with codecs.open(self.logfile, "a", encoding="utf-8") as f: |
| 76 | f.write("%s" % msg) | 77 | f.write("%s" % msg) |
| 77 | 78 | ||
| @@ -79,7 +80,7 @@ class QemuRunner: | |||
| 79 | import fcntl | 80 | import fcntl |
| 80 | fl = fcntl.fcntl(o, fcntl.F_GETFL) | 81 | fl = fcntl.fcntl(o, fcntl.F_GETFL) |
| 81 | fcntl.fcntl(o, fcntl.F_SETFL, fl | os.O_NONBLOCK) | 82 | fcntl.fcntl(o, fcntl.F_SETFL, fl | os.O_NONBLOCK) |
| 82 | return os.read(o.fileno(), 1000000) | 83 | return os.read(o.fileno(), 1000000).decode("utf-8") |
| 83 | 84 | ||
| 84 | 85 | ||
| 85 | def handleSIGCHLD(self, signum, frame): | 86 | def handleSIGCHLD(self, signum, frame): |
| @@ -229,14 +230,19 @@ class QemuRunner: | |||
| 229 | socklist.remove(self.server_socket) | 230 | socklist.remove(self.server_socket) |
| 230 | logger.info("Connection from %s:%s" % addr) | 231 | logger.info("Connection from %s:%s" % addr) |
| 231 | else: | 232 | else: |
| 232 | data = sock.recv(1024) | 233 | data = data + sock.recv(1024) |
| 233 | if data: | 234 | if data: |
| 234 | bootlog += data | 235 | try: |
| 235 | if re.search(".* login:", bootlog): | 236 | data = data.decode("utf-8") |
| 236 | self.server_socket = qemusock | 237 | bootlog += data |
| 237 | stopread = True | 238 | data = b'' |
| 238 | reachedlogin = True | 239 | if re.search(".* login:", bootlog): |
| 239 | logger.info("Reached login banner") | 240 | self.server_socket = qemusock |
| 241 | stopread = True | ||
| 242 | reachedlogin = True | ||
| 243 | logger.info("Reached login banner") | ||
| 244 | except UnicodeDecodeError: | ||
| 245 | continue | ||
| 240 | else: | 246 | else: |
| 241 | socklist.remove(sock) | 247 | socklist.remove(sock) |
| 242 | sock.close() | 248 | sock.close() |
| @@ -325,7 +331,7 @@ class QemuRunner: | |||
| 325 | # Walk the process tree from the process specified looking for a qemu-system. Return its [pid'cmd] | 331 | # Walk the process tree from the process specified looking for a qemu-system. Return its [pid'cmd] |
| 326 | # | 332 | # |
| 327 | ps = subprocess.Popen(['ps', 'axww', '-o', 'pid,ppid,command'], stdout=subprocess.PIPE).communicate()[0] | 333 | ps = subprocess.Popen(['ps', 'axww', '-o', 'pid,ppid,command'], stdout=subprocess.PIPE).communicate()[0] |
| 328 | processes = ps.split('\n') | 334 | processes = ps.decode("utf-8").split('\n') |
| 329 | nfields = len(processes[0].split()) - 1 | 335 | nfields = len(processes[0].split()) - 1 |
| 330 | pids = {} | 336 | pids = {} |
| 331 | commands = {} | 337 | commands = {} |
