diff options
author | Nathan Rossi <nathan@nathanrossi.com> | 2019-09-27 05:31:08 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-09-27 13:35:26 +0100 |
commit | 20531dc0b8f76a6e37cc856f36cd94077b6aba50 (patch) | |
tree | e0b9b1d07ba0d5730fcac8f5549816ebdfe78216 /scripts | |
parent | 3613451825b251784b7673d89db465b9782c3a31 (diff) | |
download | openembedded-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 'scripts')
-rw-r--r-- | scripts/lib/resulttool/resultutils.py | 6 |
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): if "compressed" in logdata: data = logdata.get("compressed") data = base64.b64decode(data.encode("utf-8")) - return zlib.decompress(data).decode("utf-8") + data = zlib.decompress(data) + try: + return data.decode("utf-8") + except UnicodeDecodeError: + return data return None def ptestresult_get_log(results, section): |