summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-11-21 11:42:54 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-12-04 17:24:00 +0000
commit80ed9207a784d1370982069ac9269ee0976170e2 (patch)
tree6c8174196ae94ada12eabf0fc72131e9d49f3fe0 /meta/lib
parent1e4d4762b16f6d64f10e41c1af28409a1a5bf899 (diff)
downloadpoky-80ed9207a784d1370982069ac9269ee0976170e2.tar.gz
qemurunner: Simplify binary data handling
I have concerns that bad timing of the flow of data from the logger might corrupt the output due to the way binary strings are handled in qemurunner. This simplifies the code to do the same thing it did before but much more safely. (From OE-Core rev: 20bc247316ab915465a4b1add6d09b48e07202ac) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 1e87283e92a2765bb5d54d17138b208bc395953b) Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/utils/qemurunner.py20
1 files changed, 8 insertions, 12 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 82335d8456..0631d43218 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -275,7 +275,7 @@ class QemuRunner:
275 reachedlogin = False 275 reachedlogin = False
276 stopread = False 276 stopread = False
277 qemusock = None 277 qemusock = None
278 bootlog = '' 278 bootlog = b''
279 data = b'' 279 data = b''
280 while time.time() < endtime and not stopread: 280 while time.time() < endtime and not stopread:
281 try: 281 try:
@@ -292,17 +292,13 @@ class QemuRunner:
292 else: 292 else:
293 data = data + sock.recv(1024) 293 data = data + sock.recv(1024)
294 if data: 294 if data:
295 try: 295 bootlog += data
296 data = data.decode("utf-8", errors="surrogateescape") 296 data = b''
297 bootlog += data 297 if b' login:' in bootlog:
298 data = b'' 298 self.server_socket = qemusock
299 if re.search(".* login:", bootlog): 299 stopread = True
300 self.server_socket = qemusock 300 reachedlogin = True
301 stopread = True 301 self.logger.debug("Reached login banner")
302 reachedlogin = True
303 self.logger.debug("Reached login banner")
304 except UnicodeDecodeError:
305 continue
306 else: 302 else:
307 socklist.remove(sock) 303 socklist.remove(sock)
308 sock.close() 304 sock.close()