| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 collections | 5 import collections |
| 6 import contextlib | 6 import contextlib |
| 7 import copy | 7 import copy |
| 8 import itertools | 8 import itertools |
| 9 import json | 9 import json |
| 10 | 10 |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 | 522 |
| 523 def _make_legacy_build_url(self, master_config, mastername): | 523 def _make_legacy_build_url(self, master_config, mastername): |
| 524 return self.m.archive.legacy_download_url( | 524 return self.m.archive.legacy_download_url( |
| 525 master_config.get('build_gs_bucket'), | 525 master_config.get('build_gs_bucket'), |
| 526 extra_url_components=( | 526 extra_url_components=( |
| 527 None if mastername.startswith('chromium.perf') | 527 None if mastername.startswith('chromium.perf') |
| 528 else self.m.properties['mastername'])) | 528 else self.m.properties['mastername'])) |
| 529 | 529 |
| 530 @contextlib.contextmanager | 530 @contextlib.contextmanager |
| 531 def wrap_chromium_tests(self, bot_config, tests=None): | 531 def wrap_chromium_tests(self, bot_config, tests=None): |
| 532 bot_type = bot_config.get('bot_type', 'builder_tester') | 532 with self.m.step.context({'env': self.m.chromium.get_env()}): |
| 533 bot_type = bot_config.get('bot_type', 'builder_tester') |
| 533 | 534 |
| 534 if bot_type in ('tester', 'builder_tester'): | 535 if bot_type in ('tester', 'builder_tester'): |
| 535 isolated_targets = [ | 536 isolated_targets = [ |
| 536 t.isolate_target(self.m) for t in tests if t.uses_swarming] | 537 t.isolate_target(self.m) for t in tests if t.uses_swarming] |
| 537 if isolated_targets: | 538 if isolated_targets: |
| 538 self.m.isolate.find_isolated_tests(self.m.chromium.output_dir) | 539 self.m.isolate.find_isolated_tests(self.m.chromium.output_dir) |
| 539 | 540 |
| 540 if bot_type == 'tester': | 541 if bot_type == 'tester': |
| 541 if (self.m.chromium.c.TARGET_PLATFORM == 'android' and | 542 if (self.m.chromium.c.TARGET_PLATFORM == 'android' and |
| 542 bot_config.get('root_devices')): | 543 bot_config.get('root_devices')): |
| 543 self.m.adb.root_devices() | 544 self.m.adb.root_devices() |
| 544 | 545 |
| 545 # Some recipes use this wrapper to setup devices and have their own way | 546 # Some recipes use this wrapper to setup devices and have their own way |
| 546 # to run tests. If platform is Android and tests is None, run device steps. | 547 # to run tests. If platform is Android and tests is None, run device steps
. |
| 547 require_device_steps = (tests is None or | 548 require_device_steps = (tests is None or |
| 548 any([t.uses_local_devices for t in tests])) | 549 any([t.uses_local_devices for t in tests])) |
| 549 | 550 |
| 550 if self.m.chromium.c.TARGET_PLATFORM == 'android' and require_device_steps: | 551 if self.m.chromium.c.TARGET_PLATFORM == 'android' and require_device_steps
: |
| 551 #TODO(prasadv): Remove this hack and implement specific functions | 552 #TODO(prasadv): Remove this hack and implement specific functions |
| 552 # at the point of call. | 553 # at the point of call. |
| 553 remove_system_webview = bot_config.get('remove_system_webview') | 554 remove_system_webview = bot_config.get('remove_system_webview') |
| 554 perf_setup = bot_config.matches_any_bot_id(lambda bot_id: | 555 perf_setup = bot_config.matches_any_bot_id(lambda bot_id: |
| 555 bot_id['mastername'].startswith('chromium.perf') or | 556 bot_id['mastername'].startswith('chromium.perf') or |
| 556 bot_id['mastername'].startswith('tryserver.chromium.perf')) | 557 bot_id['mastername'].startswith('tryserver.chromium.perf')) |
| 557 self.m.chromium_android.common_tests_setup_steps( | 558 self.m.chromium_android.common_tests_setup_steps( |
| 558 perf_setup=perf_setup, | 559 perf_setup=perf_setup, |
| 559 remove_system_webview=remove_system_webview) | 560 remove_system_webview=remove_system_webview) |
| 560 | 561 |
| 561 try: | 562 try: |
| 562 yield | 563 yield |
| 563 finally: | 564 finally: |
| 564 if self.m.platform.is_win: | 565 if self.m.platform.is_win: |
| 565 self.m.chromium.process_dumps() | 566 self.m.chromium.process_dumps() |
| 566 | 567 |
| 567 if self.m.chromium.c.TARGET_PLATFORM == 'android': | 568 if self.m.chromium.c.TARGET_PLATFORM == 'android': |
| 568 if require_device_steps: | 569 if require_device_steps: |
| 569 self.m.chromium_android.common_tests_final_steps( | 570 self.m.chromium_android.common_tests_final_steps( |
| 570 logcat_gs_bucket='chromium-android') | 571 logcat_gs_bucket='chromium-android') |
| 571 else: | 572 else: |
| 572 self.m.chromium_android.test_report() | 573 self.m.chromium_android.test_report() |
| 573 | 574 |
| 574 def _resolve_fixed_revisions(self, bot_update_json): | 575 def _resolve_fixed_revisions(self, bot_update_json): |
| 575 """Set all fixed revisions from the first sync to their respective | 576 """Set all fixed revisions from the first sync to their respective |
| 576 got_X_revision values. | 577 got_X_revision values. |
| 577 | 578 |
| 578 If on the first sync, a revision was requested to be HEAD, this avoids | 579 If on the first sync, a revision was requested to be HEAD, this avoids |
| 579 using HEAD potentially resolving to a different revision on the second | 580 using HEAD potentially resolving to a different revision on the second |
| 580 sync. Instead, we sync explicitly to whatever was checked out the first | 581 sync. Instead, we sync explicitly to whatever was checked out the first |
| 581 time. | 582 time. |
| 582 | 583 |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 def get_compile_targets_for_scripts(self): | 839 def get_compile_targets_for_scripts(self): |
| 839 return self.m.python( | 840 return self.m.python( |
| 840 name='get compile targets for scripts', | 841 name='get compile targets for scripts', |
| 841 script=self.m.path['checkout'].join( | 842 script=self.m.path['checkout'].join( |
| 842 'testing', 'scripts', 'get_compile_targets.py'), | 843 'testing', 'scripts', 'get_compile_targets.py'), |
| 843 args=[ | 844 args=[ |
| 844 '--output', self.m.json.output(), | 845 '--output', self.m.json.output(), |
| 845 '--', | 846 '--', |
| 846 ] + self.get_common_args_for_scripts(), | 847 ] + self.get_common_args_for_scripts(), |
| 847 step_test_data=lambda: self.m.json.test_api.output({})) | 848 step_test_data=lambda: self.m.json.test_api.output({})) |
| OLD | NEW |