tests: try and fail more gracefully with broken unicode escapes
authorAugie Fackler <augie@google.com>
Thu, 15 Jun 2017 13:13:36 -0400
changeset 32853 3139a7a1e7d4
parent 32852 3a64ac39b893
child 32854 7a877e569ed6
tests: try and fail more gracefully with broken unicode escapes
tests/run-tests.py
--- 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