| 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 Dict | 7 from recipe_engine.config import Dict |
| 8 from recipe_engine.recipe_api import Property | 8 from recipe_engine.recipe_api import Property |
| 9 | 9 |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 FAILED = 'failed' # The compile or test failed. | 57 FAILED = 'failed' # The compile or test failed. |
| 58 | 58 |
| 59 | 59 |
| 60 def _compile_and_test_at_revision(api, target_mastername, target_buildername, | 60 def _compile_and_test_at_revision(api, target_mastername, target_buildername, |
| 61 target_testername, revision, requested_tests): | 61 target_testername, revision, requested_tests): |
| 62 results = {} | 62 results = {} |
| 63 with api.step.nest('test %s' % str(revision)): | 63 with api.step.nest('test %s' % str(revision)): |
| 64 # Checkout code at the given revision to recompile. | 64 # Checkout code at the given revision to recompile. |
| 65 bot_update_step, bot_db = \ | 65 bot_update_step, bot_db = \ |
| 66 api.chromium_tests.prepare_checkout( | 66 api.chromium_tests.prepare_checkout( |
| 67 target_mastername, | 67 api.chromium_tests.create_bot_desc( |
| 68 target_buildername, | 68 target_mastername, target_buildername), |
| 69 root_solution_revision=revision) | 69 root_solution_revision=revision) |
| 70 | 70 |
| 71 # Figure out which test steps to run. | 71 # Figure out which test steps to run. |
| 72 all_tests = api.chromium_tests.tests_for_builder( | 72 all_tests = api.chromium_tests.tests_for_builder( |
| 73 target_mastername, | 73 target_mastername, |
| 74 target_testername, # If not tester, this is same as target_buildername. | 74 target_testername, # If not tester, this is same as target_buildername. |
| 75 bot_update_step, | 75 bot_update_step, |
| 76 bot_db, | 76 bot_db, |
| 77 override_bot_type='builder_tester') | 77 override_bot_type='builder_tester') |
| 78 | 78 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 assert requested_tests, 'No failed tests were specified.' | 137 assert requested_tests, 'No failed tests were specified.' |
| 138 | 138 |
| 139 # Figure out which builder configuration we should match for compile config. | 139 # Figure out which builder configuration we should match for compile config. |
| 140 # Sometimes, the builder itself runs the tests and there is no tester. In | 140 # Sometimes, the builder itself runs the tests and there is no tester. In |
| 141 # such cases, just treat the builder as a "tester". Thus, we default to | 141 # such cases, just treat the builder as a "tester". Thus, we default to |
| 142 # the target tester. | 142 # the target tester. |
| 143 tester_config = api.chromium_tests.builders.get( | 143 tester_config = api.chromium_tests.builders.get( |
| 144 target_mastername).get('builders', {}).get(target_testername) | 144 target_mastername).get('builders', {}).get(target_testername) |
| 145 target_buildername = (tester_config.get('parent_buildername') or | 145 target_buildername = (tester_config.get('parent_buildername') or |
| 146 target_testername) | 146 target_testername) |
| 147 bot_desc = api.chromium_tests.create_bot_desc( |
| 148 target_mastername, target_buildername) |
| 147 | 149 |
| 148 # Configure to match the compile config on the builder. | 150 # Configure to match the compile config on the builder. |
| 149 api.chromium_tests.configure_build( | 151 api.chromium_tests.configure_build( |
| 150 target_mastername, target_buildername, override_bot_type='builder_tester') | 152 bot_desc, override_bot_type='builder_tester') |
| 151 | 153 |
| 152 # Configure to match the test config on the tester, as builders don't have the | 154 # Configure to match the test config on the tester, as builders don't have the |
| 153 # settings for swarming tests. | 155 # settings for swarming tests. |
| 154 if target_buildername != target_testername: | 156 if target_buildername != target_testername: |
| 155 for key, value in tester_config.get('swarming_dimensions', {}).iteritems(): | 157 for key, value in tester_config.get('swarming_dimensions', {}).iteritems(): |
| 156 api.swarming.set_default_dimension(key, value) | 158 api.swarming.set_default_dimension(key, value) |
| 157 # TODO(stgao): Fix the issue that precommit=False adds the tag 'purpose:CI'. | 159 # TODO(stgao): Fix the issue that precommit=False adds the tag 'purpose:CI'. |
| 158 api.chromium_tests.configure_swarming('chromium', precommit=False) | 160 api.chromium_tests.configure_swarming('chromium', precommit=False) |
| 159 | 161 |
| 160 # Sync to bad revision, and retrieve revisions in the regression range. | 162 # Sync to bad revision, and retrieve revisions in the regression range. |
| 161 api.chromium_tests.prepare_checkout( | 163 api.chromium_tests.prepare_checkout( |
| 162 target_mastername, target_buildername, | 164 bot_desc, |
| 163 root_solution_revision=bad_revision) | 165 root_solution_revision=bad_revision) |
| 164 revisions_to_check = api.findit.revisions_between(good_revision, bad_revision) | 166 revisions_to_check = api.findit.revisions_between(good_revision, bad_revision) |
| 165 | 167 |
| 166 results = {} | 168 results = {} |
| 167 | 169 |
| 168 try: | 170 try: |
| 169 # We compile & run tests from the first revision to the last revision in the | 171 # We compile & run tests from the first revision to the last revision in the |
| 170 # regression range serially instead of a typical bisecting, because jumping | 172 # regression range serially instead of a typical bisecting, because jumping |
| 171 # between new and old revisions might affect Goma capacity and build cycle | 173 # between new and old revisions might affect Goma capacity and build cycle |
| 172 # times. Thus we plan to go with this simple serial approach first so that | 174 # times. Thus we plan to go with this simple serial approach first so that |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 ], | 333 ], |
| 332 }, | 334 }, |
| 333 })) + | 335 })) + |
| 334 api.override_step_data( | 336 api.override_step_data( |
| 335 'test r1.gl_tests (r1)', | 337 'test r1.gl_tests (r1)', |
| 336 simulated_gtest_output( | 338 simulated_gtest_output( |
| 337 failed_test_names=['Test.One', 'Test.Two'], | 339 failed_test_names=['Test.One', 'Test.Two'], |
| 338 passed_test_names=['Test.Three']) | 340 passed_test_names=['Test.Three']) |
| 339 ) | 341 ) |
| 340 ) | 342 ) |
| OLD | NEW |