| 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 """Module containing utility functions for reporting results.""" | 5 """Module containing utility functions for reporting results.""" |
| 6 | 6 |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 import re | 9 import re |
| 10 | 10 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 'ContentShellTest' for instrumentation tests) | 81 'ContentShellTest' for instrumentation tests) |
| 82 annotation: If instrumenation test type, this is a list of annotations | 82 annotation: If instrumenation test type, this is a list of annotations |
| 83 (e.g. ['Smoke', 'SmallTest']). | 83 (e.g. ['Smoke', 'SmallTest']). |
| 84 build_type: Release/Debug | 84 build_type: Release/Debug |
| 85 flakiness_server: If provider, upload the results to flakiness dashboard | 85 flakiness_server: If provider, upload the results to flakiness dashboard |
| 86 with this URL. | 86 with this URL. |
| 87 """ | 87 """ |
| 88 if not results.DidRunPass(): | 88 if not results.DidRunPass(): |
| 89 logging.critical('*' * 80) | 89 logging.critical('*' * 80) |
| 90 logging.critical('Detailed Logs') | 90 logging.critical('Detailed Logs') |
| 91 logging.critical('%s\n%s' % ('*' * 80, results.GetLogs())) | 91 logging.critical('*' * 80) |
| 92 for line in results.GetLogs().splitlines(): |
| 93 logging.critical(line) |
| 92 logging.critical('*' * 80) | 94 logging.critical('*' * 80) |
| 93 logging.critical('Summary') | 95 logging.critical('Summary') |
| 94 logging.critical('%s\n%s' % ('*' * 80, results)) | 96 logging.critical('*' * 80) |
| 97 for line in results.GetLongForm().splitlines(): |
| 98 logging.critical(line) |
| 95 logging.critical('*' * 80) | 99 logging.critical('*' * 80) |
| 96 | 100 |
| 97 if os.environ.get('BUILDBOT_BUILDERNAME'): | 101 if os.environ.get('BUILDBOT_BUILDERNAME'): |
| 98 # It is possible to have multiple buildbot steps for the same | 102 # It is possible to have multiple buildbot steps for the same |
| 99 # instrumenation test package using different annotations. | 103 # instrumenation test package using different annotations. |
| 100 if annotation and len(annotation) == 1: | 104 if annotation and len(annotation) == 1: |
| 101 test_suite = annotation[0] | 105 test_suite = annotation[0] |
| 102 else: | 106 else: |
| 103 test_suite = test_package | 107 test_suite = test_package |
| 104 _LogToFile(results, test_type, test_suite, build_type) | 108 _LogToFile(results, test_type, test_suite, build_type) |
| 105 | 109 |
| 106 if flakiness_server: | 110 if flakiness_server: |
| 107 _LogToFlakinessDashboard(results, test_type, test_package, | 111 _LogToFlakinessDashboard(results, test_type, test_package, |
| 108 flakiness_server) | 112 flakiness_server) |
| 109 | 113 |
| 110 | 114 |
| 111 def PrintAnnotation(results): | 115 def PrintAnnotation(results): |
| 112 """Print buildbot annotations for test results.""" | 116 """Print buildbot annotations for test results.""" |
| 113 if not results.DidRunPass(): | 117 if not results.DidRunPass(): |
| 114 buildbot_report.PrintError() | 118 buildbot_report.PrintError() |
| 115 else: | 119 else: |
| 116 print 'Step success!' # No annotation needed | 120 print 'Step success!' # No annotation needed |
| OLD | NEW |