sanitycheck: only log printable chars

New Qemu is emitting binary charachters which is disturbing generation
of XML, so make sure we only log printable charachters.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2018-10-15 09:45:59 -04:00
parent c2c6a6a245
commit a4c368ef07

View File

@ -159,6 +159,7 @@ Most everyday users will run with no arguments.
"""
import contextlib
import string
import mmap
import argparse
import os
@ -2274,8 +2275,8 @@ class TestSuite:
if os.path.exists(bl):
with open(bl, "rb") as f:
log = f.read().decode("utf-8")
ansi_escape = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]')
failure.text = ansi_escape.sub('', log)
filtered_string = ''.join(filter(lambda x: x in string.printable, log))
failure.text = filtered_string
f.close()
result = ET.tostring(eleTestsuites)