OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """Uploads the results to the flakiness dashboard server.""" | 5 """Uploads the results to the flakiness dashboard server.""" |
| 6 # pylint: disable=E1002,R0201 |
6 | 7 |
7 import logging | 8 import logging |
8 import os | 9 import os |
9 import shutil | 10 import shutil |
10 import subprocess | |
11 import sys | 11 import sys |
12 import tempfile | 12 import tempfile |
13 import xml | 13 import xml |
14 | 14 |
15 | 15 |
16 # Include path when ran from a Chromium checkout. | 16 # Include path when ran from a Chromium checkout. |
17 sys.path.append( | 17 sys.path.append( |
18 os.path.abspath(os.path.join(os.path.dirname(__file__), | 18 os.path.abspath(os.path.join(os.path.dirname(__file__), |
19 os.pardir, os.pardir, os.pardir, os.pardir, | 19 os.pardir, os.pardir, os.pardir, os.pardir, |
20 'third_party', 'WebKit', 'Tools', 'Scripts'))) | 20 'third_party', 'WebKit', 'Tools', 'Scripts'))) |
21 | 21 |
22 # Include path when ran from a WebKit checkout. | 22 # Include path when ran from a WebKit checkout. |
23 sys.path.append( | 23 sys.path.append( |
24 os.path.abspath(os.path.join(os.path.dirname(__file__), | 24 os.path.abspath(os.path.join(os.path.dirname(__file__), |
25 os.pardir, os.pardir, os.pardir, os.pardir, | 25 os.pardir, os.pardir, os.pardir, os.pardir, |
26 os.pardir, os.pardir, os.pardir, | 26 os.pardir, os.pardir, os.pardir, |
27 'Tools', 'Scripts'))) | 27 'Tools', 'Scripts'))) |
28 | 28 |
| 29 # pylint: disable=F0401 |
29 from webkitpy.common.system import executive, filesystem | 30 from webkitpy.common.system import executive, filesystem |
30 from webkitpy.layout_tests.layout_package import json_results_generator | 31 from webkitpy.layout_tests.layout_package import json_results_generator |
| 32 # pylint: enable=F0401 |
31 | 33 |
32 #TODO(craigdh): pylib/utils/ should not depend on pylib/. | 34 #TODO(craigdh): pylib/utils/ should not depend on pylib/. |
33 from pylib import cmd_helper | 35 from pylib import cmd_helper |
34 from pylib import constants | 36 from pylib import constants |
35 from pylib.utils import repo_utils | 37 from pylib.utils import repo_utils |
36 | 38 |
37 | 39 |
38 # The JSONResultsGenerator gets the filesystem.join operation from the Port | 40 # The JSONResultsGenerator gets the filesystem.join operation from the Port |
39 # object. Creating a Port object requires specifying information that only | 41 # object. Creating a Port object requires specifying information that only |
40 # makes sense for running WebKit layout tests, so we provide a dummy object | 42 # makes sense for running WebKit layout tests, so we provide a dummy object |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 120 |
119 if not self._build_number or not self._builder_name: | 121 if not self._build_number or not self._builder_name: |
120 raise Exception('You should not be uploading tests results to the server' | 122 raise Exception('You should not be uploading tests results to the server' |
121 'from your local machine.') | 123 'from your local machine.') |
122 | 124 |
123 upstream = (tests_type != 'Chromium_Android_Instrumentation') | 125 upstream = (tests_type != 'Chromium_Android_Instrumentation') |
124 if upstream: | 126 if upstream: |
125 # TODO(frankf): Use factory properties (see buildbot/bb_device_steps.py) | 127 # TODO(frankf): Use factory properties (see buildbot/bb_device_steps.py) |
126 # This requires passing the actual master name (e.g. 'ChromiumFYI' not | 128 # This requires passing the actual master name (e.g. 'ChromiumFYI' not |
127 # 'chromium.fyi'). | 129 # 'chromium.fyi'). |
128 from slave import slave_utils | 130 from slave import slave_utils # pylint: disable=F0401 |
129 self._build_name = slave_utils.SlaveBuildName(constants.DIR_SOURCE_ROOT) | 131 self._build_name = slave_utils.SlaveBuildName(constants.DIR_SOURCE_ROOT) |
130 self._master_name = slave_utils.GetActiveMaster() | 132 self._master_name = slave_utils.GetActiveMaster() |
131 else: | 133 else: |
132 self._build_name = 'chromium-android' | 134 self._build_name = 'chromium-android' |
133 buildbot_branch = os.environ.get('BUILDBOT_BRANCH') | 135 buildbot_branch = os.environ.get('BUILDBOT_BRANCH') |
134 if not buildbot_branch: | 136 if not buildbot_branch: |
135 buildbot_branch = 'master' | 137 buildbot_branch = 'master' |
136 self._master_name = '%s-%s' % (self._build_name, buildbot_branch) | 138 self._master_name = '%s-%s' % (self._build_name, buildbot_branch) |
137 | 139 |
138 self._test_results_map = {} | 140 self._test_results_map = {} |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 test_results_map=self._test_results_map, | 183 test_results_map=self._test_results_map, |
182 test_results_server=test_results_server, | 184 test_results_server=test_results_server, |
183 test_type=self._tests_type, | 185 test_type=self._tests_type, |
184 master_name=self._master_name) | 186 master_name=self._master_name) |
185 | 187 |
186 json_files = ["incremental_results.json", "times_ms.json"] | 188 json_files = ["incremental_results.json", "times_ms.json"] |
187 results_generator.generate_json_output() | 189 results_generator.generate_json_output() |
188 results_generator.generate_times_ms_file() | 190 results_generator.generate_times_ms_file() |
189 results_generator.upload_json_files(json_files) | 191 results_generator.upload_json_files(json_files) |
190 except Exception as e: | 192 except Exception as e: |
191 logging.error("Uploading results to test server failed: %s." % e); | 193 logging.error("Uploading results to test server failed: %s." % e) |
192 finally: | 194 finally: |
193 shutil.rmtree(tmp_folder) | 195 shutil.rmtree(tmp_folder) |
194 | 196 |
195 | 197 |
196 def Upload(results, flakiness_dashboard_server, test_type): | 198 def Upload(results, flakiness_dashboard_server, test_type): |
197 """Reports test results to the flakiness dashboard for Chrome for Android. | 199 """Reports test results to the flakiness dashboard for Chrome for Android. |
198 | 200 |
199 Args: | 201 Args: |
200 results: test results. | 202 results: test results. |
201 flakiness_dashboard_server: the server to upload the results to. | 203 flakiness_dashboard_server: the server to upload the results to. |
202 test_type: the type of the tests (as displayed by the flakiness dashboard). | 204 test_type: the type of the tests (as displayed by the flakiness dashboard). |
203 """ | 205 """ |
204 uploader = ResultsUploader(test_type) | 206 uploader = ResultsUploader(test_type) |
205 uploader.AddResults(results) | 207 uploader.AddResults(results) |
206 uploader.Upload(flakiness_dashboard_server) | 208 uploader.Upload(flakiness_dashboard_server) |
OLD | NEW |