| 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 | 6 |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 import shutil | 9 import shutil |
| 10 import subprocess | 10 import subprocess |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 """ | 81 """ |
| 82 def _is_git_directory(in_directory): | 82 def _is_git_directory(in_directory): |
| 83 """Returns true if the given directory is in a git repository. | 83 """Returns true if the given directory is in a git repository. |
| 84 | 84 |
| 85 Args: | 85 Args: |
| 86 in_directory: The directory path to be tested. | 86 in_directory: The directory path to be tested. |
| 87 """ | 87 """ |
| 88 if os.path.exists(os.path.join(in_directory, '.git')): | 88 if os.path.exists(os.path.join(in_directory, '.git')): |
| 89 return True | 89 return True |
| 90 parent = os.path.dirname(in_directory) | 90 parent = os.path.dirname(in_directory) |
| 91 if parent == constants.CHROME_DIR or parent == in_directory: | 91 if parent == constants.DIR_SOURCE_ROOT or parent == in_directory: |
| 92 return False | 92 return False |
| 93 return _is_git_directory(parent) | 93 return _is_git_directory(parent) |
| 94 | 94 |
| 95 in_directory = os.path.join(constants.CHROME_DIR, in_directory) | 95 in_directory = os.path.join(constants.DIR_SOURCE_ROOT, in_directory) |
| 96 | 96 |
| 97 if not os.path.exists(os.path.join(in_directory, '.svn')): | 97 if not os.path.exists(os.path.join(in_directory, '.svn')): |
| 98 if _is_git_directory(in_directory): | 98 if _is_git_directory(in_directory): |
| 99 return repo_utils.GetGitHeadSHA1(in_directory) | 99 return repo_utils.GetGitHeadSHA1(in_directory) |
| 100 else: | 100 else: |
| 101 return '' | 101 return '' |
| 102 | 102 |
| 103 output = cmd_helper.GetCmdOutput(['svn', 'info', '--xml'], cwd=in_directory) | 103 output = cmd_helper.GetCmdOutput(['svn', 'info', '--xml'], cwd=in_directory) |
| 104 try: | 104 try: |
| 105 dom = xml.dom.minidom.parseString(output) | 105 dom = xml.dom.minidom.parseString(output) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 119 if not self._build_number or not self._builder_name: | 119 if not self._build_number or not self._builder_name: |
| 120 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' |
| 121 'from your local machine.') | 121 'from your local machine.') |
| 122 | 122 |
| 123 upstream = (tests_type != 'Chromium_Android_Instrumentation') | 123 upstream = (tests_type != 'Chromium_Android_Instrumentation') |
| 124 if upstream: | 124 if upstream: |
| 125 # TODO(frankf): Use factory properties (see buildbot/bb_device_steps.py) | 125 # TODO(frankf): Use factory properties (see buildbot/bb_device_steps.py) |
| 126 # This requires passing the actual master name (e.g. 'ChromiumFYI' not | 126 # This requires passing the actual master name (e.g. 'ChromiumFYI' not |
| 127 # 'chromium.fyi'). | 127 # 'chromium.fyi'). |
| 128 from slave import slave_utils | 128 from slave import slave_utils |
| 129 self._build_name = slave_utils.SlaveBuildName(constants.CHROME_DIR) | 129 self._build_name = slave_utils.SlaveBuildName(constants.DIR_SOURCE_ROOT) |
| 130 self._master_name = slave_utils.GetActiveMaster() | 130 self._master_name = slave_utils.GetActiveMaster() |
| 131 else: | 131 else: |
| 132 self._build_name = 'chromium-android' | 132 self._build_name = 'chromium-android' |
| 133 buildbot_branch = os.environ.get('BUILDBOT_BRANCH') | 133 buildbot_branch = os.environ.get('BUILDBOT_BRANCH') |
| 134 if not buildbot_branch: | 134 if not buildbot_branch: |
| 135 buildbot_branch = 'master' | 135 buildbot_branch = 'master' |
| 136 self._master_name = '%s-%s' % (self._build_name, buildbot_branch) | 136 self._master_name = '%s-%s' % (self._build_name, buildbot_branch) |
| 137 | 137 |
| 138 self._test_results_map = {} | 138 self._test_results_map = {} |
| 139 | 139 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 """Reports test results to the flakiness dashboard for Chrome for Android. | 197 """Reports test results to the flakiness dashboard for Chrome for Android. |
| 198 | 198 |
| 199 Args: | 199 Args: |
| 200 results: test results. | 200 results: test results. |
| 201 flakiness_dashboard_server: the server to upload the results to. | 201 flakiness_dashboard_server: the server to upload the results to. |
| 202 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). |
| 203 """ | 203 """ |
| 204 uploader = ResultsUploader(test_type) | 204 uploader = ResultsUploader(test_type) |
| 205 uploader.AddResults(results) | 205 uploader.AddResults(results) |
| 206 uploader.Upload(flakiness_dashboard_server) | 206 uploader.Upload(flakiness_dashboard_server) |
| OLD | NEW |