| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 # Disable the line-too-long warning. | 5 # Disable the line-too-long warning. |
| 6 # pylint: disable=C0301 | 6 # pylint: disable=C0301 |
| 7 """This module implements the Chromium Performance Dashboard JSON v1.0 data | 7 """This module implements the Chromium Performance Dashboard JSON v1.0 data |
| 8 format. | 8 format. |
| 9 | 9 |
| 10 See http://www.chromium.org/developers/speed-infra/performance-dashboard/sending
-data-to-the-performance-dashboard. | 10 See http://www.chromium.org/developers/speed-infra/performance-dashboard/sending
-data-to-the-performance-dashboard. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 dashboard_group.add_argument( | 84 dashboard_group.add_argument( |
| 85 '--build-number', type=int, | 85 '--build-number', type=int, |
| 86 help='Build number, used to construct link to buildbot log by the ' | 86 help='Build number, used to construct link to buildbot log by the ' |
| 87 'dashboard.') | 87 'dashboard.') |
| 88 dashboard_group.add_argument( | 88 dashboard_group.add_argument( |
| 89 '--dry-run', action='store_true', default=False, | 89 '--dry-run', action='store_true', default=False, |
| 90 help='Display the server URL and the data to upload, but do not actually ' | 90 help='Display the server URL and the data to upload, but do not actually ' |
| 91 'upload the data.') | 91 'upload the data.') |
| 92 | 92 |
| 93 | 93 |
| 94 def normalize_label(label): |
| 95 """Normalizes a label to be used for data sent to performance dashboard. |
| 96 |
| 97 This replaces: |
| 98 '/' -> '-', as slashes are used to denote test/sub-test relation. |
| 99 ' ' -> '_', as there is a convention of not using spaces in test names. |
| 100 |
| 101 Returns: |
| 102 Normalized label. |
| 103 """ |
| 104 return label.replace('/', '-').replace(' ', '_') |
| 105 |
| 106 |
| 94 def _get_commit_count(): | 107 def _get_commit_count(): |
| 95 """Returns the number of git commits in the repository of the cwd.""" | 108 """Returns the number of git commits in the repository of the cwd.""" |
| 96 return subprocess.check_output( | 109 return subprocess.check_output( |
| 97 ["git", "rev-list", "HEAD", "--count"]).strip() | 110 ["git", "rev-list", "HEAD", "--count"]).strip() |
| 98 | 111 |
| 99 | 112 |
| 100 def _get_current_commit(): | 113 def _get_current_commit(): |
| 101 """Returns the hash of the current commit in the repository of the cwd.""" | 114 """Returns the hash of the current commit in the repository of the cwd.""" |
| 102 return subprocess.check_output(["git", "rev-parse", "HEAD"]).strip() | 115 return subprocess.check_output(["git", "rev-parse", "HEAD"]).strip() |
| 103 | 116 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 196 |
| 184 dashboard_params = urllib.urlencode({ | 197 dashboard_params = urllib.urlencode({ |
| 185 "masters": master_name, | 198 "masters": master_name, |
| 186 "bots": bot_name, | 199 "bots": bot_name, |
| 187 "tests": test_name, | 200 "tests": test_name, |
| 188 "rev": point_id | 201 "rev": point_id |
| 189 }) | 202 }) |
| 190 print "Results Dashboard: %s/report?%s" % (upload_url, dashboard_params) | 203 print "Results Dashboard: %s/report?%s" % (upload_url, dashboard_params) |
| 191 | 204 |
| 192 return True | 205 return True |
| OLD | NEW |