| 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 import base64 | 5 import base64 |
| 6 import collections | 6 import collections |
| 7 import json | 7 import json |
| 8 | 8 |
| 9 DEPS = [ | 9 DEPS = [ |
| 10 'auto_bisect', | 10 'auto_bisect', |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 min_rev = range_data[0]['hash'] | 251 min_rev = range_data[0]['hash'] |
| 252 max_rev = range_data[-1]['hash'] | 252 max_rev = range_data[-1]['hash'] |
| 253 output = [[r['hash'], 'ignored'] for r in range_data[1:-1]] | 253 output = [[r['hash'], 'ignored'] for r in range_data[1:-1]] |
| 254 step_name = ('Expanding revision range.for revisions %s:%s' % | 254 step_name = ('Expanding revision range.for revisions %s:%s' % |
| 255 (min_rev, max_rev)) | 255 (min_rev, max_rev)) |
| 256 return api.step_data(step_name, stdout=api.json.output(output)) | 256 return api.step_data(step_name, stdout=api.json.output(output)) |
| 257 | 257 |
| 258 | 258 |
| 259 def _get_step_data_for_revision(api, revision_data, skip_results=False): | 259 def _get_step_data_for_revision(api, revision_data, skip_results=False): |
| 260 """Generator that produces step patches for fake results.""" | 260 """Generator that produces step patches for fake results.""" |
| 261 commit_pos_number = revision_data['commit_pos'] | 261 commit_pos = revision_data['commit_pos'] |
| 262 commit_hash = revision_data['hash'] | 262 commit_hash = revision_data['hash'] |
| 263 test_results = revision_data['test_results'] | 263 test_results = revision_data['test_results'] |
| 264 | 264 |
| 265 if 'refrange' in revision_data: | 265 if 'refrange' in revision_data: |
| 266 parent_step = 'Resolving reference range.' | 266 parent_step = 'Resolving reference range.' |
| 267 commit_pos = 'refs/heads/master@{#%s}' % commit_pos_number | 267 step_name = parent_step + 'resolving commit_pos ' + commit_pos |
| 268 step_name = parent_step + 'crrev get commit hash for ' + commit_pos | 268 yield api.step_data(step_name, stdout=api.raw_io.output('hash:' + |
| 269 yield api.step_data( | 269 commit_hash)) |
| 270 step_name, | |
| 271 stdout=api.json.output({'git_sha': commit_hash})) | |
| 272 | 270 |
| 273 if not skip_results: | 271 if not skip_results: |
| 274 step_name = ('Waiting for chromium@%s.gsutil ' | 272 step_name = ('Waiting for chromium@%s.gsutil ' |
| 275 'Get test results for build %s') % (commit_hash[:10], | 273 'Get test results for build %s') % (commit_hash[:10], |
| 276 commit_hash) | 274 commit_hash) |
| 277 if 'refrange' in revision_data: | 275 if 'refrange' in revision_data: |
| 278 parent_step = 'Gathering reference values.' | 276 parent_step = 'Gathering reference values.' |
| 279 else: | 277 else: |
| 280 parent_step = 'Working on revision %s.' % ('chromium@' + commit_hash[:10]) | 278 parent_step = 'Working on revision %s.' % ('chromium@' + commit_hash[:10]) |
| 281 yield _get_post_bisect_step_data(api, parent_step) | 279 yield _get_post_bisect_step_data(api, parent_step) |
| 282 step_name = parent_step + step_name | 280 step_name = parent_step + step_name |
| 283 yield api.step_data(step_name, stdout=api.raw_io.output(json.dumps( | 281 yield api.step_data(step_name, stdout=api.raw_io.output(json.dumps( |
| 284 test_results))) | 282 test_results))) |
| 285 | 283 |
| 286 if 'cl_info' in revision_data: | 284 if 'cl_info' in revision_data: |
| 287 step_name = 'Reading culprit cl information.' | 285 step_name = 'Reading culprit cl information.' |
| 288 stdout = api.json.output(revision_data['cl_info']) | 286 stdout = api.json.output(revision_data['cl_info']) |
| 289 yield api.step_data(step_name, stdout=stdout) | 287 yield api.step_data(step_name, stdout=stdout) |
| 290 | 288 |
| 291 | 289 |
| 292 def _get_post_bisect_step_data(api, parent_step=''): | 290 def _get_post_bisect_step_data(api, parent_step=''): |
| 293 """Gets step data for perf_dashboard/resource/post_json.py.""" | 291 """Gets step data for perf_dashboard/resource/post_json.py.""" |
| 294 response = {'status_code': 200} | 292 response = {'status_code': 200} |
| 295 return api.step_data(parent_step + 'Post bisect results', | 293 return api.step_data(parent_step + 'Post bisect results', |
| 296 stdout=api.json.output(response)) | 294 stdout=api.json.output(response)) |
| OLD | NEW |