| 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 from recipe_engine.config import List | 7 from recipe_engine.config import List |
| 8 from recipe_engine.config import Single | 8 from recipe_engine.config import Single |
| 9 from recipe_engine.recipe_api import Property | 9 from recipe_engine.recipe_api import Property |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 class CompileResult(object): | 43 class CompileResult(object): |
| 44 SKIPPED = 'skipped' # No compile is needed. | 44 SKIPPED = 'skipped' # No compile is needed. |
| 45 PASSED = 'passed' # Compile passed. | 45 PASSED = 'passed' # Compile passed. |
| 46 FAILED = 'failed' # Compile failed. | 46 FAILED = 'failed' # Compile failed. |
| 47 | 47 |
| 48 | 48 |
| 49 def _run_compile_at_revision(api, target_mastername, target_buildername, | 49 def _run_compile_at_revision(api, target_mastername, target_buildername, |
| 50 revision, compile_targets, use_analyze): | 50 revision, compile_targets, use_analyze): |
| 51 with api.step.nest('test %s' % str(revision)): | 51 with api.step.nest('test %s' % str(revision)): |
| 52 bot_desc = api.chromium_tests.create_bot_desc( |
| 53 target_mastername, target_buildername) |
| 52 # Checkout code at the given revision to recompile. | 54 # Checkout code at the given revision to recompile. |
| 53 bot_update_step, bot_db = \ | 55 bot_update_step, bot_db = \ |
| 54 api.chromium_tests.prepare_checkout( | 56 api.chromium_tests.prepare_checkout( |
| 55 target_mastername, | 57 bot_desc, |
| 56 target_buildername, | |
| 57 root_solution_revision=revision) | 58 root_solution_revision=revision) |
| 58 | 59 |
| 59 # TODO(http://crbug.com/560991): if compile targets are provided, check | 60 # TODO(http://crbug.com/560991): if compile targets are provided, check |
| 60 # whether they exist and then use analyze to compile the impacted ones by | 61 # whether they exist and then use analyze to compile the impacted ones by |
| 61 # the given revision. | 62 # the given revision. |
| 62 compile_targets = sorted(set(compile_targets or [])) | 63 compile_targets = sorted(set(compile_targets or [])) |
| 63 if not compile_targets: | 64 if not compile_targets: |
| 64 compile_targets, _ = api.chromium_tests.get_compile_targets_and_tests( | 65 compile_targets, _ = api.chromium_tests.get_compile_targets_and_tests( |
| 65 target_mastername, | 66 bot_desc, |
| 66 target_buildername, | |
| 67 bot_db, | 67 bot_db, |
| 68 override_bot_type='builder_tester') | 68 override_bot_type='builder_tester') |
| 69 | 69 |
| 70 if use_analyze: | 70 if use_analyze: |
| 71 changed_files = api.findit.files_changed_by_revision(revision) | 71 changed_files = api.findit.files_changed_by_revision(revision) |
| 72 | 72 |
| 73 _, compile_targets = api.chromium_tests.analyze( | 73 _, compile_targets = api.chromium_tests.analyze( |
| 74 changed_files, | 74 changed_files, |
| 75 test_targets=[], | 75 test_targets=[], |
| 76 additional_compile_targets=compile_targets, | 76 additional_compile_targets=compile_targets, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 97 return CompileResult.PASSED | 97 return CompileResult.PASSED |
| 98 except api.step.InfraFailure: | 98 except api.step.InfraFailure: |
| 99 raise | 99 raise |
| 100 except api.step.StepFailure: | 100 except api.step.StepFailure: |
| 101 return CompileResult.FAILED | 101 return CompileResult.FAILED |
| 102 | 102 |
| 103 | 103 |
| 104 def RunSteps(api, target_mastername, target_buildername, | 104 def RunSteps(api, target_mastername, target_buildername, |
| 105 good_revision, bad_revision, | 105 good_revision, bad_revision, |
| 106 requested_compile_targets, use_analyze): | 106 requested_compile_targets, use_analyze): |
| 107 bot_desc = api.chromium_tests.create_bot_desc( |
| 108 target_mastername, target_buildername) |
| 107 api.chromium_tests.configure_build( | 109 api.chromium_tests.configure_build( |
| 108 target_mastername, target_buildername, override_bot_type='builder_tester') | 110 bot_desc, override_bot_type='builder_tester') |
| 109 | 111 |
| 110 # Sync to bad revision, and retrieve revisions in the regression range. | 112 # Sync to bad revision, and retrieve revisions in the regression range. |
| 111 api.chromium_tests.prepare_checkout( | 113 api.chromium_tests.prepare_checkout( |
| 112 target_mastername, target_buildername, | 114 bot_desc, root_solution_revision=bad_revision) |
| 113 root_solution_revision=bad_revision) | |
| 114 revisions_to_check = api.findit.revisions_between(good_revision, bad_revision) | 115 revisions_to_check = api.findit.revisions_between(good_revision, bad_revision) |
| 115 | 116 |
| 116 results = [] | 117 results = [] |
| 117 try: | 118 try: |
| 118 for current_revision in revisions_to_check: | 119 for current_revision in revisions_to_check: |
| 119 compile_result = _run_compile_at_revision( | 120 compile_result = _run_compile_at_revision( |
| 120 api, target_mastername, target_buildername, | 121 api, target_mastername, target_buildername, |
| 121 current_revision, requested_compile_targets, use_analyze) | 122 current_revision, requested_compile_targets, use_analyze) |
| 122 | 123 |
| 123 results.append([current_revision, compile_result]) | 124 results.append([current_revision, compile_result]) |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 })) + | 235 })) + |
| 235 api.override_step_data( | 236 api.override_step_data( |
| 236 'test r1.analyze', | 237 'test r1.analyze', |
| 237 api.json.output({ | 238 api.json.output({ |
| 238 'status': 'Found dependency', | 239 'status': 'Found dependency', |
| 239 'compile_targets': ['a', 'a_run'], | 240 'compile_targets': ['a', 'a_run'], |
| 240 'test_targets': ['a', 'a_run'], | 241 'test_targets': ['a', 'a_run'], |
| 241 }) | 242 }) |
| 242 ) | 243 ) |
| 243 ) | 244 ) |
| OLD | NEW |