summaryrefslogtreecommitdiffstats
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-11-21 13:11:03 +0000
commita9d7f098f9cee38aa06967e31afea10006986fb6 (patch)
tree93f0b08ead98bd8987884b50b430938e12795099
parent0c2ba7146837af473b3f9f8bdbbb93af61db03e3 (diff)
downloadopenembedded-core-contrib-a9d7f098f9cee38aa06967e31afea10006986fb6.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: 1e87283e92a2765bb5d54d17138b208bc395953b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-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:
reachedlogin = False
stopread = False
qemusock = None
- bootlog = ''
+ bootlog = b''
data = b''
while time.time() < endtime and not stopread:
try:
@@ -292,17 +292,13 @@ class QemuRunner:
else:
data = data + sock.recv(1024)
if data:
- try:
- data = data.decode("utf-8", errors="surrogateescape")
- bootlog += data
- data = b''
- if re.search(".* login:", bootlog):
- self.server_socket = qemusock
- stopread = True
- reachedlogin = True
- self.logger.debug("Reached login banner")
- except UnicodeDecodeError:
- continue
+ bootlog += data
+ data = b''
+ if b' login:' in bootlog:
+ self.server_socket = qemusock
+ stopread = True
+ reachedlogin = True
+ self.logger.debug("Reached login banner")
else:
socklist.remove(sock)
sock.close()