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