summaryrefslogtreecommitdiffstats
path: root/scripts/lib/resulttool
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-30 16:55:21 +0100
commitec1104fd7fc0311e918fa832a566d3c8aedc2f11 (patch)
treea87481ad426890a557e5946d7974c5c97cdb5bed /scripts/lib/resulttool
parent02a334c98fef6a8af9ee3dcd29815dbe6d145d3c (diff)
downloadpoky-ec1104fd7fc0311e918fa832a566d3c8aedc2f11.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. (From OE-Core rev: 20531dc0b8f76a6e37cc856f36cd94077b6aba50) Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/resulttool')
-rw-r--r--scripts/lib/resulttool/resultutils.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/lib/resulttool/resultutils.py b/scripts/lib/resulttool/resultutils.py
index 177fb25f93..7cb85a6aa9 100644
--- a/scripts/lib/resulttool/resultutils.py
+++ b/scripts/lib/resulttool/resultutils.py
@@ -126,7 +126,11 @@ def decode_log(logdata):
126 if "compressed" in logdata: 126 if "compressed" in logdata:
127 data = logdata.get("compressed") 127 data = logdata.get("compressed")
128 data = base64.b64decode(data.encode("utf-8")) 128 data = base64.b64decode(data.encode("utf-8"))
129 return zlib.decompress(data).decode("utf-8") 129 data = zlib.decompress(data)
130 try:
131 return data.decode("utf-8")
132 except UnicodeDecodeError:
133 return data
130 return None 134 return None
131 135
132def ptestresult_get_log(results, section): 136def ptestresult_get_log(results, section):