| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 # Checkout code at the given revision to recompile. | 52 # Checkout code at the given revision to recompile. |
| 53 bot_update_step, master_dict, test_spec = \ | 53 bot_update_step, bot_db = \ |
| 54 api.chromium_tests.prepare_checkout( | 54 api.chromium_tests.prepare_checkout( |
| 55 target_mastername, | 55 target_mastername, |
| 56 target_buildername, | 56 target_buildername, |
| 57 root_solution_revision=revision) | 57 root_solution_revision=revision) |
| 58 | 58 |
| 59 # TODO(http://crbug.com/560991): if compile targets are provided, check | 59 # 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 | 60 # whether they exist and then use analyze to compile the impacted ones by |
| 61 # the given revision. | 61 # the given revision. |
| 62 compile_targets = sorted(set(compile_targets or [])) | 62 compile_targets = sorted(set(compile_targets or [])) |
| 63 if not compile_targets: | 63 if not compile_targets: |
| 64 compile_targets, _ = api.chromium_tests.get_compile_targets_and_tests( | 64 compile_targets, _ = api.chromium_tests.get_compile_targets_and_tests( |
| 65 target_mastername, | 65 target_mastername, |
| 66 target_buildername, | 66 target_buildername, |
| 67 master_dict, | 67 bot_db, |
| 68 test_spec, | |
| 69 override_bot_type='builder_tester') | 68 override_bot_type='builder_tester') |
| 70 | 69 |
| 71 if use_analyze: | 70 if use_analyze: |
| 72 changed_files = api.findit.files_changed_by_revision(revision) | 71 changed_files = api.findit.files_changed_by_revision(revision) |
| 73 | 72 |
| 74 _, compile_targets = api.chromium_tests.analyze( | 73 _, compile_targets = api.chromium_tests.analyze( |
| 75 changed_files, | 74 changed_files, |
| 76 test_targets=[], | 75 test_targets=[], |
| 77 additional_compile_targets=compile_targets, | 76 additional_compile_targets=compile_targets, |
| 78 config_file_name='trybot_analyze_config.json', | 77 config_file_name='trybot_analyze_config.json', |
| 79 mb_mastername=target_mastername, | 78 mb_mastername=target_mastername, |
| 80 mb_buildername=target_buildername, | 79 mb_buildername=target_buildername, |
| 81 additional_names=None) | 80 additional_names=None) |
| 82 | 81 |
| 83 if not compile_targets: | 82 if not compile_targets: |
| 84 # No compile target is impacted by the given revision. | 83 # No compile target is impacted by the given revision. |
| 85 return CompileResult.SKIPPED | 84 return CompileResult.SKIPPED |
| 86 | 85 |
| 87 try: | 86 try: |
| 88 api.chromium_tests.compile_specific_targets( | 87 api.chromium_tests.compile_specific_targets( |
| 89 target_mastername, | 88 target_mastername, |
| 90 target_buildername, | 89 target_buildername, |
| 91 bot_update_step, | 90 bot_update_step, |
| 92 master_dict, | 91 bot_db, |
| 93 compile_targets, | 92 compile_targets, |
| 94 tests_including_triggered=[], | 93 tests_including_triggered=[], |
| 95 mb_mastername=target_mastername, | 94 mb_mastername=target_mastername, |
| 96 mb_buildername=target_buildername, | 95 mb_buildername=target_buildername, |
| 97 override_bot_type='builder_tester') | 96 override_bot_type='builder_tester') |
| 98 return CompileResult.PASSED | 97 return CompileResult.PASSED |
| 99 except api.step.InfraFailure: | 98 except api.step.InfraFailure: |
| 100 raise | 99 raise |
| 101 except api.step.StepFailure: | 100 except api.step.StepFailure: |
| 102 return CompileResult.FAILED | 101 return CompileResult.FAILED |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 })) + | 234 })) + |
| 236 api.override_step_data( | 235 api.override_step_data( |
| 237 'test r1.analyze', | 236 'test r1.analyze', |
| 238 api.json.output({ | 237 api.json.output({ |
| 239 'status': 'Found dependency', | 238 'status': 'Found dependency', |
| 240 'compile_targets': ['a', 'a_run'], | 239 'compile_targets': ['a', 'a_run'], |
| 241 'test_targets': ['a', 'a_run'], | 240 'test_targets': ['a', 'a_run'], |
| 242 }) | 241 }) |
| 243 ) | 242 ) |
| 244 ) | 243 ) |
| OLD | NEW |