summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-11-21 11:42:54 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-03-04 11:11:59 +0000
commit9a2074b54a39358df0a21f735d755dbf8e5367d1 (patch)
treed6a9ed9b62f711ebb641a152ee9c7a457b494bd4 /meta/lib/oeqa
parent66f536ad57d00f05defbbbf8f7cc64822666ad82 (diff)
downloadpoky-9a2074b54a39358df0a21f735d755dbf8e5367d1.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) (From OE-Core rev: 84f801e44f4b5ba65489a3a418e5f699abccd003) 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> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
-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 7ca9f1c736..360aa3fc37 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -274,7 +274,7 @@ class QemuRunner:
274 reachedlogin = False 274 reachedlogin = False
275 stopread = False 275 stopread = False
276 qemusock = None 276 qemusock = None
277 bootlog = '' 277 bootlog = b''
278 data = b'' 278 data = b''
279 while time.time() < endtime and not stopread: 279 while time.time() < endtime and not stopread:
280 try: 280 try:
@@ -291,17 +291,13 @@ class QemuRunner:
291 else: 291 else:
292 data = data + sock.recv(1024) 292 data = data + sock.recv(1024)
293 if data: 293 if data:
294 try: 294 bootlog += data
295 data = data.decode("utf-8", errors="surrogateescape") 295 data = b''
296 bootlog += data 296 if b' login:' in bootlog:
297 data = b'' 297 self.server_socket = qemusock
298 if re.search(".* login:", bootlog): 298 stopread = True
299 self.server_socket = qemusock 299 reachedlogin = True
300 stopread = True 300 self.logger.debug("Reached login banner")
301 reachedlogin = True
302 self.logger.debug("Reached login banner")
303 except UnicodeDecodeError:
304 continue
305 else: 301 else:
306 socklist.remove(sock) 302 socklist.remove(sock)
307 sock.close() 303 sock.close()