diff options
| -rw-r--r-- | meta/lib/oeqa/core/case.py | 4 | ||||
| -rw-r--r-- | scripts/lib/resulttool/resultutils.py | 6 |
2 files changed, 7 insertions, 3 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: | |||
| 59 | """ | 59 | """ |
| 60 | @staticmethod | 60 | @staticmethod |
| 61 | def _compress_log(log): | 61 | def _compress_log(log): |
| 62 | logdata = log.encode("utf-8") | 62 | logdata = log.encode("utf-8") if isinstance(log, str) else log |
| 63 | logdata = zlib.compress(logdata) | 63 | logdata = zlib.compress(logdata) |
| 64 | logdata = base64.b64encode(logdata).decode("utf-8") | 64 | logdata = base64.b64encode(logdata).decode("utf-8") |
| 65 | return {"compressed" : logdata} | 65 | return {"compressed" : logdata} |
| @@ -80,7 +80,7 @@ class OEPTestResultTestCase: | |||
| 80 | if log is not None: | 80 | if log is not None: |
| 81 | sections[section]["log"] = self._compress_log(log) | 81 | sections[section]["log"] = self._compress_log(log) |
| 82 | elif logfile is not None: | 82 | elif logfile is not None: |
| 83 | with open(logfile, "r") as f: | 83 | with open(logfile, "rb") as f: |
| 84 | sections[section]["log"] = self._compress_log(f.read()) | 84 | sections[section]["log"] = self._compress_log(f.read()) |
| 85 | 85 | ||
| 86 | if duration is not None: | 86 | if duration is not None: |
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 | ||
| 132 | def ptestresult_get_log(results, section): | 136 | def ptestresult_get_log(results, section): |
