| 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 json | 5 import json |
| 6 | 6 |
| 7 DEPS = [ | 7 DEPS = [ |
| 8 'auto_bisect', | 8 'auto_bisect', |
| 9 'chromium_tests', | 9 'chromium_tests', |
| 10 'recipe_engine/json', | 10 'recipe_engine/json', |
| 11 'recipe_engine/path', | 11 'recipe_engine/path', |
| 12 'recipe_engine/properties', | 12 'recipe_engine/properties', |
| 13 'recipe_engine/raw_io', | 13 'recipe_engine/raw_io', |
| 14 'recipe_engine/step', | 14 'recipe_engine/step', |
| 15 ] | 15 ] |
| 16 | 16 |
| 17 """This file is a recipe demonstrating the auto_bisect recipe module. | 17 """This file is a recipe demonstrating the auto_bisect recipe module. |
| 18 | 18 |
| 19 For more information about recipes, see: https://goo.gl/xKnjz6 | 19 For more information about recipes, see: https://goo.gl/xKnjz6 |
| 20 """ | 20 """ |
| 21 | 21 |
| 22 | 22 |
| 23 def RunSteps(api): | 23 def RunSteps(api): |
| 24 fake_checkout_path = api.path.mkdtemp('fake_checkout') | 24 fake_checkout_path = api.path.mkdtemp('fake_checkout') |
| 25 api.path['checkout'] = fake_checkout_path | 25 api.path['checkout'] = fake_checkout_path |
| 26 bisector = api.auto_bisect.create_bisector(api.properties['bisect_config']) | 26 bisector = api.auto_bisect.create_bisector(api.properties['bisect_config'], |
| 27 do_not_nest_wait_for_revision=True) |
| 27 | 28 |
| 28 # Request builds and tests for initial range and wait. | 29 # Request builds and tests for initial range and wait. |
| 29 bisector.good_rev.start_job() | 30 bisector.good_rev.start_job() |
| 30 bisector.bad_rev.start_job() | 31 bisector.bad_rev.start_job() |
| 31 bisector.wait_for_all([bisector.good_rev, bisector.bad_rev]) | 32 bisector.wait_for_all([bisector.good_rev, bisector.bad_rev]) |
| 32 | 33 |
| 33 if bisector.good_rev.failed or bisector.bad_rev.failed: | 34 if bisector.good_rev.failed or bisector.bad_rev.failed: |
| 34 return | 35 return |
| 35 | 36 |
| 36 assert bisector.check_improvement_direction() | 37 assert bisector.check_improvement_direction() |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 81 |
| 81 invalid_config_test = api.test('invalid_config') | 82 invalid_config_test = api.test('invalid_config') |
| 82 invalid_config_test += api.properties( | 83 invalid_config_test += api.properties( |
| 83 bisect_config=_get_config({'good_revision': 'not a valid revision'})) | 84 bisect_config=_get_config({'good_revision': 'not a valid revision'})) |
| 84 yield invalid_config_test | 85 yield invalid_config_test |
| 85 | 86 |
| 86 failed_build_test = _make_test( | 87 failed_build_test = _make_test( |
| 87 api, _get_ref_range_only_test_data(), 'failed_build_test', | 88 api, _get_ref_range_only_test_data(), 'failed_build_test', |
| 88 extra_config={'dummy_builds': None}) | 89 extra_config={'dummy_builds': None}) |
| 89 failed_build_test += api.step_data('gsutil ls', retcode=1) | 90 failed_build_test += api.step_data('gsutil ls', retcode=1) |
| 91 failed_build_test += api.step_data('gsutil ls (2)' , retcode=1) |
| 92 failed_build_test += api.step_data('gsutil ls (3)' , retcode=1) |
| 90 failed_build_test += api.step_data( | 93 failed_build_test += api.step_data( |
| 91 'Waiting for chromium@a6298e4afe.gsutil ls' , retcode=1) | 94 'fetch builder state', |
| 92 failed_build_test += api.step_data( | |
| 93 'Waiting for chromium@a6298e4afe.fetch builder state', | |
| 94 api.raw_io.output(json.dumps({'cachedBuilds': ['2106']}))) | 95 api.raw_io.output(json.dumps({'cachedBuilds': ['2106']}))) |
| 95 failed_build_test += api.step_data( | 96 failed_build_test += api.step_data( |
| 96 'Waiting for chromium@a6298e4afe.fetch build details', | 97 'fetch build details', |
| 97 api.raw_io.output(json.dumps({ | 98 api.raw_io.output(json.dumps({ |
| 98 'results': 2, | 99 'results': 2, |
| 99 'properties': [('build_archive_url', | 100 'properties': [('build_archive_url', |
| 100 ('gs://chrome-perf/Linux Builder/full-build-linux_' | 101 ('gs://chrome-perf/Linux Builder/full-build-linux_' |
| 101 'a6298e4afedbf2cd461755ea6f45b0ad64222222.zip'))] | 102 'a6298e4afedbf2cd461755ea6f45b0ad64222222.zip'))] |
| 102 }))) | 103 }))) |
| 103 yield failed_build_test | 104 yield failed_build_test |
| 104 | 105 |
| 105 | 106 |
| 106 delayed_build_test = _make_test( | 107 delayed_build_test = _make_test( |
| 107 api, _get_ref_range_only_test_data(), 'delayed_build_test', | 108 api, _get_ref_range_only_test_data(), 'delayed_build_test', |
| 108 extra_config={'dummy_builds': None}) | 109 extra_config={'dummy_builds': None}) |
| 109 delayed_build_test += api.step_data('gsutil ls', retcode=1) | 110 delayed_build_test += api.step_data('gsutil ls', retcode=1) |
| 111 delayed_build_test += api.step_data('gsutil ls (2)', retcode=1) |
| 112 delayed_build_test += api.step_data('gsutil ls (3)', retcode=1) |
| 113 delayed_build_test += api.step_data('gsutil ls (4)', retcode=1) |
| 114 delayed_build_test += api.step_data('gsutil ls (5)', retcode=1) |
| 115 delayed_build_test += api.step_data('gsutil ls (6)', retcode=1) |
| 110 delayed_build_test += api.step_data( | 116 delayed_build_test += api.step_data( |
| 111 'Waiting for chromium@a6298e4afe.gsutil ls', retcode=1) | 117 'fetch builder state', |
| 112 delayed_build_test += api.step_data( | |
| 113 'Waiting for chromium@a6298e4afe.gsutil ls (2)', retcode=1) | |
| 114 delayed_build_test += api.step_data( | |
| 115 'Waiting for chromium@a6298e4afe.gsutil ls (3)', retcode=1) | |
| 116 delayed_build_test += api.step_data( | |
| 117 'Waiting for chromium@a6298e4afe.fetch builder state', | |
| 118 api.raw_io.output(json.dumps({'cachedBuilds': []}))) | 118 api.raw_io.output(json.dumps({'cachedBuilds': []}))) |
| 119 delayed_build_test += api.step_data( | 119 delayed_build_test += api.step_data( |
| 120 'Waiting for chromium@a6298e4afe.fetch builder state (2)', | 120 'fetch builder state (2)', |
| 121 api.raw_io.output(json.dumps({'cachedBuilds': ['2106']}))) | 121 api.raw_io.output(json.dumps({'cachedBuilds': ['2106']}))) |
| 122 delayed_build_test += api.step_data( | 122 delayed_build_test += api.step_data( |
| 123 'Waiting for chromium@a6298e4afe.fetch build details', | 123 'fetch build details', |
| 124 api.raw_io.output(json.dumps({ | 124 api.raw_io.output(json.dumps({ |
| 125 'properties': [('build_archive_url', | 125 'properties': [('build_archive_url', |
| 126 ('gs://chrome-perf/Linux Builder/full-build-linux_' | 126 ('gs://chrome-perf/Linux Builder/full-build-linux_' |
| 127 'a6298e4afedbf2cd461755ea6f45b0ad64222222.zip'))] | 127 'a6298e4afedbf2cd461755ea6f45b0ad64222222.zip'))] |
| 128 }))) | 128 }))) |
| 129 delayed_build_test += api.step_data( | 129 delayed_build_test += api.step_data( |
| 130 'Waiting for chromium@a6298e4afe.fetch build details (2)', | 130 'fetch build details (2)', |
| 131 api.raw_io.output(json.dumps({ | 131 api.raw_io.output(json.dumps({ |
| 132 'results': 2, | 132 'results': 2, |
| 133 'properties': [('build_archive_url', | 133 'properties': [('build_archive_url', |
| 134 ('gs://chrome-perf/Linux Builder/full-build-linux_' | 134 ('gs://chrome-perf/Linux Builder/full-build-linux_' |
| 135 'a6298e4afedbf2cd461755ea6f45b0ad64222222.zip'))] | 135 'a6298e4afedbf2cd461755ea6f45b0ad64222222.zip'))] |
| 136 }))) | 136 }))) |
| 137 yield delayed_build_test | 137 yield delayed_build_test |
| 138 | 138 |
| 139 missing_metric_test = _make_test( | 139 missing_metric_test = _make_test( |
| 140 api, _get_ref_range_only_missing_metric_test_data(), | 140 api, _get_ref_range_only_missing_metric_test_data(), |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 if 'refrange' in revision_data: | 423 if 'refrange' in revision_data: |
| 424 parent_step = 'Resolving reference range.' | 424 parent_step = 'Resolving reference range.' |
| 425 commit_pos = 'refs/heads/master@{#%s}' % commit_pos_number | 425 commit_pos = 'refs/heads/master@{#%s}' % commit_pos_number |
| 426 step_name = parent_step + 'crrev get commit hash for ' + commit_pos | 426 step_name = parent_step + 'crrev get commit hash for ' + commit_pos |
| 427 yield api.step_data( | 427 yield api.step_data( |
| 428 step_name, | 428 step_name, |
| 429 stdout=api.json.output({'git_sha': commit_hash})) | 429 stdout=api.json.output({'git_sha': commit_hash})) |
| 430 | 430 |
| 431 if include_build_steps: | 431 if include_build_steps: |
| 432 if test_results: | 432 if test_results: |
| 433 step_name = ('Waiting for chromium@%s.gsutil ' | 433 step_name = ('gsutil Get test results for build %s') % commit_hash |
| 434 'Get test results for build %s') % (commit_hash[:10], | |
| 435 commit_hash) | |
| 436 yield api.step_data(step_name, stdout=api.json.output(test_results)) | 434 yield api.step_data(step_name, stdout=api.json.output(test_results)) |
| 437 | 435 |
| 438 if revision_data.get('DEPS', False): | 436 if revision_data.get('DEPS', False): |
| 439 step_name = 'fetch file %s:DEPS' % commit_hash | 437 step_name = 'fetch file %s:DEPS' % commit_hash |
| 440 yield api.step_data(step_name, stdout=api.raw_io.output( | 438 yield api.step_data(step_name, stdout=api.raw_io.output( |
| 441 revision_data['DEPS'])) | 439 revision_data['DEPS'])) |
| 442 | 440 |
| 443 if 'git_diff' in revision_data: | 441 if 'git_diff' in revision_data: |
| 444 for deps_rev, diff_file in revision_data['git_diff'].iteritems(): | 442 for deps_rev, diff_file in revision_data['git_diff'].iteritems(): |
| 445 step_name = 'Generating patch for %s:DEPS to %s' | 443 step_name = 'Generating patch for %s:DEPS to %s' |
| (...skipping 12 matching lines...) Expand all Loading... |
| 458 yield api.step_data(step_name, stdout=api.raw_io.output(file_hash)) | 456 yield api.step_data(step_name, stdout=api.raw_io.output(file_hash)) |
| 459 step_name = 'Expanding revision range for revision %s on depot %s' | 457 step_name = 'Expanding revision range for revision %s on depot %s' |
| 460 step_name %= (interval[-1], depot_name) | 458 step_name %= (interval[-1], depot_name) |
| 461 stdout = api.json.output([(r, 0) for r in interval[:-1]]) | 459 stdout = api.json.output([(r, 0) for r in interval[:-1]]) |
| 462 yield api.step_data(step_name, stdout=stdout) | 460 yield api.step_data(step_name, stdout=stdout) |
| 463 | 461 |
| 464 if 'cl_info' in revision_data: | 462 if 'cl_info' in revision_data: |
| 465 step_name = 'Reading culprit cl information.' | 463 step_name = 'Reading culprit cl information.' |
| 466 stdout = api.json.output(revision_data['cl_info']) | 464 stdout = api.json.output(revision_data['cl_info']) |
| 467 yield api.step_data(step_name, stdout=stdout) | 465 yield api.step_data(step_name, stdout=stdout) |
| OLD | NEW |