mirror of
https://git.yoctoproject.org/poky
synced 2026-03-06 15:29:40 +01:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
02a334c98f
commit
ec1104fd7f
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user