summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorNathan Rossi <nathan@nathanrossi.com>2019-09-27 05:31:08 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-09-27 13:35:26 +0100
commit20531dc0b8f76a6e37cc856f36cd94077b6aba50 (patch)
treee0b9b1d07ba0d5730fcac8f5549816ebdfe78216 /meta/lib
parent3613451825b251784b7673d89db465b9782c3a31 (diff)
downloadopenembedded-core-contrib-20531dc0b8f76a6e37cc856f36cd94077b6aba50.tar.gz
oeqa/core/case.py: Encode binary data of log
Do not decode the log content into a string only to re-encode it as binary data again. Some logs might un-intentionally contain bytes that do not decode as utf-8, as such preserve the log file content as it was on disk. Handle the decoding on the resulttool side, but also handle the failure to decode the data. Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/core/case.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/meta/lib/oeqa/core/case.py b/meta/lib/oeqa/core/case.py
index 180635ac6c..aae451fef2 100644
--- a/meta/lib/oeqa/core/case.py
+++ b/meta/lib/oeqa/core/case.py
@@ -59,7 +59,7 @@ class OEPTestResultTestCase:
"""
@staticmethod
def _compress_log(log):
- logdata = log.encode("utf-8")
+ logdata = log.encode("utf-8") if isinstance(log, str) else log
logdata = zlib.compress(logdata)
logdata = base64.b64encode(logdata).decode("utf-8")
return {"compressed" : logdata}
@@ -80,7 +80,7 @@ class OEPTestResultTestCase:
if log is not None:
sections[section]["log"] = self._compress_log(log)
elif logfile is not None:
- with open(logfile, "r") as f:
+ with open(logfile, "rb") as f:
sections[section]["log"] = self._compress_log(f.read())
if duration is not None: