From f716c0ca43bc6d9e90b109120dc827094b22b0a7 Mon Sep 17 00:00:00 2001
From: "Nicolas \"Pixel\" Noble" <pixel@nobis-crew.org>
Date: Sun, 12 Jul 2015 01:26:17 +0200
Subject: [PATCH] Filtering stdout for JUnit report in case of timeouts.

We're not properly filtering stdout in case we're timeouting. This generates invalid XML output.
---
 tools/run_tests/jobset.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/run_tests/jobset.py b/tools/run_tests/jobset.py
index b9af169739..46137f01f4 100755
--- a/tools/run_tests/jobset.py
+++ b/tools/run_tests/jobset.py
@@ -209,10 +209,11 @@ class Job(object):
     elif self._state == _RUNNING and time.time() - self._start > 600:
       self._tempfile.seek(0)
       stdout = self._tempfile.read()
+      filtered_stdout = filter(lambda x: x in string.printable, stdout.decode(errors='ignore'))
       message('TIMEOUT', self._spec.shortname, stdout, do_newline=True)
       self.kill()
       if self._xml_test is not None:
-        ET.SubElement(self._xml_test, 'system-out').text = stdout
+        ET.SubElement(self._xml_test, 'system-out').text = filtered_stdout
         ET.SubElement(self._xml_test, 'error', message='Timeout')
     return self._state
 
-- 
GitLab