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