From a4c368ef070b0ae24d760441ffefdd075766e889 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Mon, 15 Oct 2018 09:45:59 -0400 Subject: [PATCH] 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 --- scripts/sanitycheck | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/sanitycheck b/scripts/sanitycheck index 665573d2953..67053d63100 100755 --- a/scripts/sanitycheck +++ b/scripts/sanitycheck @@ -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)