| 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 # pylint: disable=E1002,R0201 |
| 7 | 7 |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import shutil | 10 import shutil |
| 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. | |
| 17 sys.path.append( | |
| 18 os.path.abspath(os.path.join(os.path.dirname(__file__), | |
| 19 os.pardir, os.pardir, os.pardir, os.pardir, | |
| 20 'third_party', 'WebKit', 'Tools', 'Scripts'))) | |
| 21 | |
| 22 # Include path when ran from a WebKit checkout. | |
| 23 sys.path.append( | |
| 24 os.path.abspath(os.path.join(os.path.dirname(__file__), | |
| 25 os.pardir, os.pardir, os.pardir, os.pardir, | |
| 26 os.pardir, os.pardir, os.pardir, | |
| 27 'Tools', 'Scripts'))) | |
| 28 | |
| 29 # pylint: disable=F0401 | |
| 30 from webkitpy.common.system import executive, filesystem | |
| 31 from webkitpy.layout_tests.layout_package import json_results_generator | |
| 32 # pylint: enable=F0401 | |
| 33 | |
| 34 #TODO(craigdh): pylib/utils/ should not depend on pylib/. | 16 #TODO(craigdh): pylib/utils/ should not depend on pylib/. |
| 35 from pylib import cmd_helper | 17 from pylib import cmd_helper |
| 36 from pylib import constants | 18 from pylib import constants |
| 19 from pylib.utils import json_results_generator |
| 37 from pylib.utils import repo_utils | 20 from pylib.utils import repo_utils |
| 38 | 21 |
| 39 | 22 |
| 40 # The JSONResultsGenerator gets the filesystem.join operation from the Port | |
| 41 # object. Creating a Port object requires specifying information that only | |
| 42 # makes sense for running WebKit layout tests, so we provide a dummy object | |
| 43 # that contains the fields required by the generator. | |
| 44 class PortDummy(object): | |
| 45 def __init__(self): | |
| 46 self._executive = executive.Executive() | |
| 47 self._filesystem = filesystem.FileSystem() | |
| 48 | |
| 49 | 23 |
| 50 class JSONResultsGenerator(json_results_generator.JSONResultsGeneratorBase): | 24 class JSONResultsGenerator(json_results_generator.JSONResultsGeneratorBase): |
| 51 """Writes test results to a JSON file and handles uploading that file to | 25 """Writes test results to a JSON file and handles uploading that file to |
| 52 the test results server. | 26 the test results server. |
| 53 """ | 27 """ |
| 54 def __init__(self, port, builder_name, build_name, build_number, tmp_folder, | 28 def __init__(self, builder_name, build_name, build_number, tmp_folder, |
| 55 test_results_map, test_results_server, test_type, master_name): | 29 test_results_map, test_results_server, test_type, master_name): |
| 56 super(JSONResultsGenerator, self).__init__( | 30 super(JSONResultsGenerator, self).__init__( |
| 57 port=port, | |
| 58 builder_name=builder_name, | 31 builder_name=builder_name, |
| 59 build_name=build_name, | 32 build_name=build_name, |
| 60 build_number=build_number, | 33 build_number=build_number, |
| 61 results_file_base_path=tmp_folder, | 34 results_file_base_path=tmp_folder, |
| 62 builder_base_url=None, | 35 builder_base_url=None, |
| 63 test_results_map=test_results_map, | 36 test_results_map=test_results_map, |
| 64 svn_repositories=(('webkit', 'third_party/WebKit'), | 37 svn_repositories=(('webkit', 'third_party/WebKit'), |
| 65 ('chrome', '.')), | 38 ('chrome', '.')), |
| 66 test_results_server=test_results_server, | 39 test_results_server=test_results_server, |
| 67 test_type=test_type, | 40 test_type=test_type, |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 self._test_results_map[single_test_result.GetName()] = test_result | 141 self._test_results_map[single_test_result.GetName()] = test_result |
| 169 | 142 |
| 170 def Upload(self, test_results_server): | 143 def Upload(self, test_results_server): |
| 171 if not self._test_results_map: | 144 if not self._test_results_map: |
| 172 return | 145 return |
| 173 | 146 |
| 174 tmp_folder = tempfile.mkdtemp() | 147 tmp_folder = tempfile.mkdtemp() |
| 175 | 148 |
| 176 try: | 149 try: |
| 177 results_generator = JSONResultsGenerator( | 150 results_generator = JSONResultsGenerator( |
| 178 port=PortDummy(), | |
| 179 builder_name=self._builder_name, | 151 builder_name=self._builder_name, |
| 180 build_name=self._build_name, | 152 build_name=self._build_name, |
| 181 build_number=self._build_number, | 153 build_number=self._build_number, |
| 182 tmp_folder=tmp_folder, | 154 tmp_folder=tmp_folder, |
| 183 test_results_map=self._test_results_map, | 155 test_results_map=self._test_results_map, |
| 184 test_results_server=test_results_server, | 156 test_results_server=test_results_server, |
| 185 test_type=self._tests_type, | 157 test_type=self._tests_type, |
| 186 master_name=self._master_name) | 158 master_name=self._master_name) |
| 187 | 159 |
| 188 json_files = ["incremental_results.json", "times_ms.json"] | 160 json_files = ["incremental_results.json", "times_ms.json"] |
| (...skipping 10 matching lines...) Expand all Loading... |
| 199 """Reports test results to the flakiness dashboard for Chrome for Android. | 171 """Reports test results to the flakiness dashboard for Chrome for Android. |
| 200 | 172 |
| 201 Args: | 173 Args: |
| 202 results: test results. | 174 results: test results. |
| 203 flakiness_dashboard_server: the server to upload the results to. | 175 flakiness_dashboard_server: the server to upload the results to. |
| 204 test_type: the type of the tests (as displayed by the flakiness dashboard). | 176 test_type: the type of the tests (as displayed by the flakiness dashboard). |
| 205 """ | 177 """ |
| 206 uploader = ResultsUploader(test_type) | 178 uploader = ResultsUploader(test_type) |
| 207 uploader.AddResults(results) | 179 uploader.AddResults(results) |
| 208 uploader.Upload(flakiness_dashboard_server) | 180 uploader.Upload(flakiness_dashboard_server) |
| OLD | NEW |