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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 2. Log to local files for aggregating multiple test steps | 78 2. Log to local files for aggregating multiple test steps |
79 (on buildbots only). | 79 (on buildbots only). |
80 3. Log to flakiness dashboard (on buildbots only). | 80 3. Log to flakiness dashboard (on buildbots only). |
81 | 81 |
82 Args: | 82 Args: |
83 results: An instance of TestRunResults object. | 83 results: An instance of TestRunResults object. |
84 test_type: Type of the test (e.g. 'Instrumentation', 'Unit test', etc.). | 84 test_type: Type of the test (e.g. 'Instrumentation', 'Unit test', etc.). |
85 test_package: Test package name (e.g. 'ipc_tests' for gtests, | 85 test_package: Test package name (e.g. 'ipc_tests' for gtests, |
86 'ContentShellTest' for instrumentation tests) | 86 'ContentShellTest' for instrumentation tests) |
87 annotation: If instrumenation test type, this is a list of annotations | 87 annotation: If instrumenation test type, this is a list of annotations |
88 (e.g. ['Smoke', 'SmallTest']). | 88 (e.g. ['Feature', 'SmallTest']). |
89 flakiness_server: If provider, upload the results to flakiness dashboard | 89 flakiness_server: If provider, upload the results to flakiness dashboard |
90 with this URL. | 90 with this URL. |
91 """ | 91 """ |
92 if not results.DidRunPass(): | 92 if not results.DidRunPass(): |
93 logging.critical('*' * 80) | 93 logging.critical('*' * 80) |
94 logging.critical('Detailed Logs') | 94 logging.critical('Detailed Logs') |
95 logging.critical('*' * 80) | 95 logging.critical('*' * 80) |
96 for line in results.GetLogs().splitlines(): | 96 for line in results.GetLogs().splitlines(): |
97 logging.critical(line) | 97 logging.critical(line) |
98 logging.critical('*' * 80) | 98 logging.critical('*' * 80) |
99 logging.critical('Summary') | 99 logging.critical('Summary') |
100 logging.critical('*' * 80) | 100 logging.critical('*' * 80) |
101 for line in results.GetGtestForm().splitlines(): | 101 for line in results.GetGtestForm().splitlines(): |
102 logging.critical(line) | 102 logging.critical(line) |
103 logging.critical('*' * 80) | 103 logging.critical('*' * 80) |
104 | 104 |
105 if os.environ.get('BUILDBOT_BUILDERNAME'): | 105 if os.environ.get('BUILDBOT_BUILDERNAME'): |
106 # It is possible to have multiple buildbot steps for the same | 106 # It is possible to have multiple buildbot steps for the same |
107 # instrumenation test package using different annotations. | 107 # instrumenation test package using different annotations. |
108 if annotation and len(annotation) == 1: | 108 if annotation and len(annotation) == 1: |
109 suite_name = annotation[0] | 109 suite_name = annotation[0] |
110 else: | 110 else: |
111 suite_name = test_package | 111 suite_name = test_package |
112 _LogToFile(results, test_type, suite_name) | 112 _LogToFile(results, test_type, suite_name) |
113 | 113 |
114 if flakiness_server: | 114 if flakiness_server: |
115 _LogToFlakinessDashboard(results, test_type, test_package, | 115 _LogToFlakinessDashboard(results, test_type, test_package, |
116 flakiness_server) | 116 flakiness_server) |
OLD | NEW |