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 """ | 5 """ |
6 Recipe for building and running tests for Libyuv stand-alone. | 6 Recipe for building and running tests for Libyuv stand-alone. |
7 """ | 7 """ |
8 | 8 |
9 from recipe_engine.types import freeze | 9 from recipe_engine.types import freeze |
10 | 10 |
11 DEPS = [ | 11 DEPS = [ |
12 'chromium', | 12 'chromium', |
| 13 'chromium_android', |
13 'depot_tools/bot_update', | 14 'depot_tools/bot_update', |
14 'depot_tools/gclient', | 15 'depot_tools/gclient', |
15 'depot_tools/tryserver', | 16 'depot_tools/tryserver', |
16 'libyuv', | 17 'libyuv', |
17 'recipe_engine/path', | 18 'recipe_engine/path', |
18 'recipe_engine/platform', | 19 'recipe_engine/platform', |
19 'recipe_engine/properties', | 20 'recipe_engine/properties', |
20 'recipe_engine/step', | 21 'recipe_engine/step', |
21 ] | 22 ] |
22 | 23 |
| 24 |
23 def RunSteps(api): | 25 def RunSteps(api): |
24 libyuv = api.libyuv | 26 libyuv = api.libyuv |
25 libyuv.apply_bot_config(libyuv.BUILDERS, libyuv.RECIPE_CONFIGS) | 27 libyuv.apply_bot_config(libyuv.BUILDERS, libyuv.RECIPE_CONFIGS) |
26 | 28 |
27 api.bot_update.ensure_checkout(force=True) | 29 libyuv.checkout() |
28 api.chromium.ensure_goma() | 30 api.chromium.ensure_goma() |
29 api.chromium.runhooks() | 31 api.chromium.runhooks() |
30 | 32 |
31 if libyuv.should_build: | 33 if libyuv.should_build: |
32 if api.chromium.c.project_generator.tool == 'gn': | 34 if api.chromium.c.project_generator.tool == 'gn': |
33 api.chromium.run_gn(use_goma=True) | 35 api.chromium.run_gn(use_goma=True) |
34 api.chromium.compile(targets=['all']) | 36 api.chromium.compile(targets=['all']) |
35 else: | 37 else: |
36 api.chromium.compile() | 38 api.chromium.compile() |
| 39 if libyuv.should_upload_build: |
| 40 libyuv.package_build() |
| 41 |
| 42 if libyuv.should_download_build: |
| 43 libyuv.extract_build() |
37 | 44 |
38 if libyuv.should_test: | 45 if libyuv.should_test: |
39 api.chromium.runtest('libyuv_unittest') | 46 libyuv.runtests() |
40 | 47 |
| 48 libyuv.maybe_trigger() |
41 | 49 |
42 def _sanitize_nonalpha(text): | 50 def _sanitize_nonalpha(text): |
43 return ''.join(c if c.isalnum() else '_' for c in text.lower()) | 51 return ''.join(c if c.isalnum() else '_' for c in text.lower()) |
44 | 52 |
45 | 53 |
46 def GenTests(api): | 54 def GenTests(api): |
47 builders = api.libyuv.BUILDERS | 55 builders = api.libyuv.BUILDERS |
48 | 56 |
49 def generate_builder(mastername, buildername, revision, suffix=None): | 57 def generate_builder(mastername, buildername, revision, suffix=None): |
50 suffix = suffix or '' | 58 suffix = suffix or '' |
51 bot_config = builders[mastername]['builders'][buildername] | 59 bot_config = builders[mastername]['builders'][buildername] |
| 60 bot_type = bot_config.get('bot_type', 'builder_tester') |
| 61 |
| 62 if bot_type in ('builder', 'builder_tester'): |
| 63 assert bot_config.get('parent_buildername') is None, ( |
| 64 'Unexpected parent_buildername for builder %r on master %r.' % |
| 65 (buildername, mastername)) |
52 | 66 |
53 chromium_kwargs = bot_config.get('chromium_config_kwargs', {}) | 67 chromium_kwargs = bot_config.get('chromium_config_kwargs', {}) |
54 test = ( | 68 test = ( |
55 api.test('%s_%s%s' % (_sanitize_nonalpha(mastername), | 69 api.test('%s_%s%s' % (_sanitize_nonalpha(mastername), |
56 _sanitize_nonalpha(buildername), suffix)) + | 70 _sanitize_nonalpha(buildername), suffix)) + |
57 api.properties(mastername=mastername, | 71 api.properties(mastername=mastername, |
58 buildername=buildername, | 72 buildername=buildername, |
59 slavename='slavename', | 73 slavename='slavename', |
60 BUILD_CONFIG=chromium_kwargs['BUILD_CONFIG']) + | 74 BUILD_CONFIG=chromium_kwargs['BUILD_CONFIG']) + |
61 api.platform(bot_config['testing']['platform'], | 75 api.platform(bot_config['testing']['platform'], |
62 chromium_kwargs.get('TARGET_BITS', 64)) | 76 chromium_kwargs.get('TARGET_BITS', 64)) |
63 ) | 77 ) |
64 | 78 |
| 79 if bot_config.get('parent_buildername'): |
| 80 test += api.properties( |
| 81 parent_buildername=bot_config['parent_buildername']) |
| 82 |
65 if revision: | 83 if revision: |
66 test += api.properties(revision=revision) | 84 test += api.properties(revision=revision) |
| 85 if bot_type == 'tester': |
| 86 test += api.properties(parent_got_revision=revision) |
67 | 87 |
68 if mastername.startswith('tryserver'): | 88 if mastername.startswith('tryserver'): |
69 test += api.properties(patch_url='try_job_svn_patch') | 89 test += api.properties(patch_url='try_job_svn_patch') |
| 90 test += api.properties(buildnumber=1337) |
70 return test | 91 return test |
71 | 92 |
72 for mastername, master_config in builders.iteritems(): | 93 for mastername, master_config in builders.iteritems(): |
73 for buildername in master_config['builders'].keys(): | 94 for buildername in master_config['builders'].keys(): |
74 yield generate_builder(mastername, buildername, revision='12345') | 95 yield generate_builder(mastername, buildername, revision='12345') |
75 | 96 |
76 # Forced builds (not specifying any revision) and test failures. | 97 # Forced builds (not specifying any revision) and test failures. |
77 mastername = 'client.libyuv' | 98 mastername = 'client.libyuv' |
78 yield generate_builder(mastername, 'Linux64 Debug', revision=None, | 99 yield generate_builder(mastername, 'Linux64 Debug', revision=None, |
79 suffix='_forced') | 100 suffix='_forced') |
80 yield generate_builder(mastername, 'Android Debug', revision=None, | 101 yield generate_builder(mastername, 'Android Debug', revision=None, |
81 suffix='_forced') | 102 suffix='_forced') |
82 | 103 |
83 yield generate_builder('tryserver.libyuv', 'linux', revision=None, | 104 yield generate_builder('tryserver.libyuv', 'linux', revision=None, |
84 suffix='_forced') | 105 suffix='_forced') |
OLD | NEW |