[Piglit] [PATCH 3/5] framework: handle UnicodeDecodeError

Marek Olšák maraeo at gmail.com
Wed May 2 20:32:45 UTC 2018


From: Marek Olšák <marek.olsak at amd.com>

This happens due to LLVM printing colored text into stdout/stderr on error.
---
 framework/test/base.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/framework/test/base.py b/framework/test/base.py
index 134b87245..f187c0210 100644
--- a/framework/test/base.py
+++ b/framework/test/base.py
@@ -369,20 +369,23 @@ class Test(object):
                 os.killpg(os.getpgid(proc.pid), signal.SIGKILL)
 
             # Since the process isn't running it's safe to get any remaining
             # stdout/stderr values out and store them.
             self.result.out, self.result.err = proc.communicate()
 
             raise TestRunError(
                 'Test run time exceeded timeout value ({} seconds)\n'.format(
                     self.timeout),
                 'timeout')
+        # LLVM prints colored text into stdout/stderr on error, which raises:
+        except UnicodeDecodeError as e:
+            raise TestRunError("UnicodeDecodeError.\n", 'crash')
 
         # The setter handles the bytes/unicode conversion
         self.result.out = out
         self.result.err = err
         self.result.returncode = returncode
 
     def __eq__(self, other):
         return self.command == other.command
 
     def __ne__(self, other):
-- 
2.17.0



More information about the Piglit mailing list