changeset 32871:3139a7a1e7d4

tests: try and fail more gracefully with broken unicode escapes
author Augie Fackler <augie@google.com>
date Thu, 15 Jun 2017 13:13:36 -0400
parents 3a64ac39b893
children 7a877e569ed6
files tests/run-tests.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Thu Jun 15 12:49:13 2017 -0400
+++ b/tests/run-tests.py	Thu Jun 15 13:13:36 2017 -0400
@@ -2093,13 +2093,17 @@
             for tc, __ in testcases:
                 if tc.name in timesd:
                     diff = result.faildata.get(tc.name, b'')
+                    try:
+                        diff = diff.decode('unicode_escape')
+                    except UnicodeDecodeError as e:
+                        diff = '%r decoding diff, sorry' % e
                     tres = {'result': res,
                             'time': ('%0.3f' % timesd[tc.name][2]),
                             'cuser': ('%0.3f' % timesd[tc.name][0]),
                             'csys': ('%0.3f' % timesd[tc.name][1]),
                             'start': ('%0.3f' % timesd[tc.name][3]),
                             'end': ('%0.3f' % timesd[tc.name][4]),
-                            'diff': diff.decode('unicode_escape'),
+                            'diff': diff,
                             }
                 else:
                     # blacklisted test