Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import logging | 5 import logging |
| 6 import sys | 6 import sys |
| 7 import time | 7 import time |
| 8 import unittest | 8 import unittest |
| 9 | 9 |
| 10 from telemetry.page import page_test_results | 10 from telemetry.page import page_test_results |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 super(GTestTestResults, self).addSuccess(test) | 56 super(GTestTestResults, self).addSuccess(test) |
| 57 test_name = GTestTestResults._formatTestname(test) | 57 test_name = GTestTestResults._formatTestname(test) |
| 58 print >> self._output_stream, '[ OK ]', test_name, ( | 58 print >> self._output_stream, '[ OK ]', test_name, ( |
| 59 '(%0.f ms)' % self._GetMs()) | 59 '(%0.f ms)' % self._GetMs()) |
| 60 sys.stdout.flush() | 60 sys.stdout.flush() |
| 61 | 61 |
| 62 def addSkip(self, test, reason): | 62 def addSkip(self, test, reason): |
| 63 super(GTestTestResults, self).addSkip(test, reason) | 63 super(GTestTestResults, self).addSkip(test, reason) |
| 64 test_name = GTestTestResults._formatTestname(test) | 64 test_name = GTestTestResults._formatTestname(test) |
| 65 logging.warning('===== SKIPPING TEST %s: %s =====', test_name, reason) | 65 logging.warning('===== SKIPPING TEST %s: %s =====', test_name, reason) |
| 66 if self._timestamp == None: | |
| 67 self._timestamp = time.time() | |
|
jeremy
2013/12/15 13:03:36
What is this change needed for?
aberent
2013/12/16 17:07:43
Actually nothing to do with this CL. I hit a crash
jeremy
2013/12/17 11:29:44
Makes sense, can you ask dtu@ or someone else fami
| |
| 66 print >> self._output_stream, '[ OK ]', test_name, ( | 68 print >> self._output_stream, '[ OK ]', test_name, ( |
| 67 '(%0.f ms)' % self._GetMs()) | 69 '(%0.f ms)' % self._GetMs()) |
| 68 sys.stdout.flush() | 70 sys.stdout.flush() |
| 69 | 71 |
| 70 def PrintSummary(self): | 72 def PrintSummary(self): |
| 71 unit = 'test' if len(self.successes) == 1 else 'tests' | 73 unit = 'test' if len(self.successes) == 1 else 'tests' |
| 72 print >> self._output_stream, '[ PASSED ]', ( | 74 print >> self._output_stream, '[ PASSED ]', ( |
| 73 '%d %s.' % (len(self.successes), unit)) | 75 '%d %s.' % (len(self.successes), unit)) |
| 74 if self.errors or self.failures: | 76 if self.errors or self.failures: |
| 75 all_errors = self.errors[:] | 77 all_errors = self.errors[:] |
| 76 all_errors.extend(self.failures) | 78 all_errors.extend(self.failures) |
| 77 unit = 'test' if len(all_errors) == 1 else 'tests' | 79 unit = 'test' if len(all_errors) == 1 else 'tests' |
| 78 print >> self._output_stream, '[ FAILED ]', ( | 80 print >> self._output_stream, '[ FAILED ]', ( |
| 79 '%d %s, listed below:' % (len(all_errors), unit)) | 81 '%d %s, listed below:' % (len(all_errors), unit)) |
| 80 for test, _ in all_errors: | 82 for test, _ in all_errors: |
| 81 print >> self._output_stream, '[ FAILED ] ', ( | 83 print >> self._output_stream, '[ FAILED ] ', ( |
| 82 GTestTestResults._formatTestname(test)) | 84 GTestTestResults._formatTestname(test)) |
| 83 if not self.wasSuccessful(): | 85 if not self.wasSuccessful(): |
| 84 print >> self._output_stream | 86 print >> self._output_stream |
| 85 count = len(self.errors) + len(self.failures) | 87 count = len(self.errors) + len(self.failures) |
| 86 unit = 'TEST' if count == 1 else 'TESTS' | 88 unit = 'TEST' if count == 1 else 'TESTS' |
| 87 print >> self._output_stream, '%d FAILED %s' % (count, unit) | 89 print >> self._output_stream, '%d FAILED %s' % (count, unit) |
| 88 print >> self._output_stream | 90 print >> self._output_stream |
| 89 sys.stdout.flush() | 91 sys.stdout.flush() |
| OLD | NEW |