Chromium Code Reviews| 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 from recipe_engine import recipe_api | 5 from recipe_engine import recipe_api |
| 6 from . import builders | 6 from . import builders |
| 7 | 7 |
| 8 | 8 |
| 9 class LibyuvApi(recipe_api.RecipeApi): | 9 class LibyuvApi(recipe_api.RecipeApi): |
| 10 BUILDERS = builders.BUILDERS | 10 BUILDERS = builders.BUILDERS |
| 11 RECIPE_CONFIGS = builders.RECIPE_CONFIGS | 11 RECIPE_CONFIGS = builders.RECIPE_CONFIGS |
| 12 | 12 |
| 13 def __init__(self, **kwargs): | 13 def __init__(self, **kwargs): |
| 14 super(LibyuvApi, self).__init__(**kwargs) | 14 super(LibyuvApi, self).__init__(**kwargs) |
| 15 | 15 |
| 16 | |
| 17 def apply_bot_config(self, builders, recipe_configs, perf_config=None): | 16 def apply_bot_config(self, builders, recipe_configs, perf_config=None): |
| 18 mastername = self.m.properties.get('mastername') | 17 mastername = self.m.properties.get('mastername') |
| 19 buildername = self.m.properties.get('buildername') | 18 buildername = self.m.properties.get('buildername') |
| 20 master_dict = builders.get(mastername, {}) | 19 master_dict = builders.get(mastername, {}) |
| 20 self.master_config = master_dict.get('settings', {}) | |
| 21 | 21 |
| 22 self.bot_config = master_dict.get('builders', {}).get(buildername) | 22 self.bot_config = master_dict.get('builders', {}).get(buildername) |
| 23 assert self.bot_config, ('Unrecognized builder name "%r" for master "%r".' % | 23 assert self.bot_config, ('Unrecognized builder name "%r" for master "%r".' % |
| 24 (buildername, mastername)) | 24 (buildername, mastername)) |
| 25 | 25 |
| 26 self.bot_type = self.bot_config['bot_type'] | 26 self.bot_type = self.bot_config['bot_type'] |
| 27 recipe_config_name = self.bot_config['recipe_config'] | 27 recipe_config_name = self.bot_config['recipe_config'] |
| 28 self.recipe_config = recipe_configs.get(recipe_config_name) | 28 self.recipe_config = recipe_configs.get(recipe_config_name) |
| 29 assert self.recipe_config, ( | 29 assert self.recipe_config, ( |
| 30 'Cannot find recipe_config "%s" for builder "%r".' % | 30 'Cannot find recipe_config "%s" for builder "%r".' % |
| 31 (recipe_config_name, buildername)) | 31 (recipe_config_name, buildername)) |
| 32 | 32 |
| 33 chromium_kwargs = self.bot_config.get('chromium_config_kwargs', {}) | 33 chromium_kwargs = self.bot_config.get('chromium_config_kwargs', {}) |
| 34 if self.recipe_config.get('chromium_android_config'): | |
| 35 self.m.chromium_android.set_config( | |
| 36 self.recipe_config['chromium_android_config'], **chromium_kwargs) | |
| 34 | 37 |
| 35 self.m.chromium.set_config(self.recipe_config['chromium_config'], | 38 self.m.chromium.set_config(self.recipe_config['chromium_config'], |
| 36 **chromium_kwargs) | 39 **chromium_kwargs) |
| 37 self.m.gclient.set_config(self.recipe_config['gclient_config']) | 40 self.m.gclient.set_config(self.recipe_config['gclient_config']) |
| 38 | 41 |
| 39 # Support applying configs both at the bot and the recipe config level. | 42 # Support applying configs both at the bot and the recipe config level. |
| 40 for c in self.bot_config.get('chromium_apply_config', []): | 43 for c in self.bot_config.get('chromium_apply_config', []): |
| 41 self.m.chromium.apply_config(c) | 44 self.m.chromium.apply_config(c) |
| 42 for c in self.bot_config.get('gclient_apply_config', []): | 45 for c in self.bot_config.get('gclient_apply_config', []): |
| 43 self.m.gclient.apply_config(c) | 46 self.m.gclient.apply_config(c) |
| 44 | 47 |
| 45 if self.m.tryserver.is_tryserver: | 48 if self.m.tryserver.is_tryserver: |
| 46 self.m.chromium.apply_config('trybot_flavor') | 49 self.m.chromium.apply_config('trybot_flavor') |
| 47 | 50 |
| 48 @property | 51 @property |
| 49 def should_build(self): | 52 def should_build(self): |
| 50 return self.bot_type in ('builder', 'builder_tester') | 53 return self.bot_type in ('builder', 'builder_tester') |
| 51 | 54 |
| 52 @property | 55 @property |
| 53 def should_test(self): | 56 def should_test(self): |
| 54 return self.bot_type in ('tester', 'builder_tester') | 57 return self.bot_type in ('tester', 'builder_tester') |
| 58 | |
| 59 @property | |
| 60 def should_upload_build(self): | |
| 61 return self.bot_config.get('triggers') | |
| 62 | |
| 63 @property | |
| 64 def should_download_build(self): | |
| 65 return self.bot_config.get('parent_buildername') | |
| 66 | |
| 67 def checkout(self): | |
| 68 update_step = self.m.bot_update.ensure_checkout(force=True) | |
| 69 assert update_step.json.output['did_run'] | |
| 70 self.revision = update_step.presentation.properties['got_revision'] | |
| 71 | |
| 72 def maybe_trigger(self): | |
| 73 triggers = self.bot_config.get('triggers') | |
| 74 if triggers: | |
| 75 properties = { | |
| 76 'revision': self.revision, | |
| 77 'parent_got_revision': self.revision, | |
| 78 } | |
| 79 self.m.trigger(*[{ | |
| 80 'builder_name': builder_name, | |
| 81 'properties': properties, | |
| 82 } for builder_name in triggers]) | |
| 83 | |
| 84 | |
| 85 def package_build(self): | |
| 86 upload_url = self.m.archive.legacy_upload_url( | |
| 87 self.master_config.get('build_gs_bucket'), | |
| 88 extra_url_components=self.m.properties['mastername']) | |
| 89 self.m.archive.zip_and_upload_build( | |
| 90 'package build', | |
| 91 self.m.chromium.c.build_config_fs, | |
| 92 upload_url, | |
| 93 build_revision=self.revision) | |
| 94 | |
| 95 def extract_build(self): | |
| 96 if not self.m.properties.get('parent_got_revision'): | |
| 97 raise self.m.step.StepFailure( | |
| 98 'Testers cannot be forced without providing revision information.' | |
|
Michael Achenbach
2016/09/06 08:17:49
nit: add spaces where the string wraps.
kjellander_chromium
2016/09/06 10:52:34
Done.
| |
| 99 'Please select a previous build and click [Rebuild] or force a build' | |
| 100 'for a Builder instead (will trigger new runs for the testers).') | |
| 101 | |
| 102 # Ensure old build directory is not used is by removing it. | |
|
Michael Achenbach
2016/09/06 08:17:49
nit: grammar. "is" too much? Or maybe restructure
kjellander_chromium
2016/09/06 10:52:34
Done.
| |
| 103 self.m.file.rmtree( | |
| 104 'build directory', | |
| 105 self.m.chromium.c.build_dir.join(self.m.chromium.c.build_config_fs)) | |
| 106 | |
| 107 download_url = self.m.archive.legacy_download_url( | |
| 108 self.master_config.get('build_gs_bucket'), | |
| 109 extra_url_components=self.m.properties['mastername']) | |
| 110 self.m.archive.download_and_unzip_build( | |
| 111 'extract build', | |
| 112 self.m.chromium.c.build_config_fs, | |
| 113 download_url, | |
| 114 build_revision=self.revision) | |
| 115 | |
| 116 def runtests(self): | |
| 117 """Add a suite of test steps.""" | |
| 118 with self.m.step.defer_results(): | |
| 119 if self.m.chromium.c.TARGET_PLATFORM == 'android': | |
| 120 self.m.chromium_android.common_tests_setup_steps() | |
| 121 self.m.chromium_android.run_test_suite('yuv_unittest') | |
| 122 self.m.chromium_android.shutdown_device_monitor() | |
| 123 self.m.chromium_android.logcat_dump(gs_bucket='chromium-android') | |
|
Michael Achenbach
2016/09/06 08:17:49
Maybe keep gs bucket generic?
self.master_config.g
kjellander_chromium
2016/09/06 10:52:34
right, I should get a separate bucket for libyuv f
| |
| 124 self.m.chromium_android.stack_tool_steps(force_latest_version=True) | |
| 125 self.m.chromium_android.test_report() | |
| 126 else: | |
| 127 self.m.chromium.runtest('libyuv_unittest') | |
| OLD | NEW |